Answer to Question #4969 in C++ for zuhaib abbasi
2011-11-03T10:00:53-04:00
write a program in c++ user press enter than display students information, as given,
students name,father name, adress, telephone no,nic card no,street no.
1
2011-11-04T10:11:53-0400
// Histogram.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "conio.h" #include <iostream> #include <string> using namespace std; class Student{ private: string studentname; string fathername; string address; string telephoneno; string niccardno; string streetno; public: Student(){} void setName(string studentn){ studentname=studentn; } void setfathername(string fathern){ fathername=fathern; } void setAddress(string addres){ address=addres; } void setTelephoneno(string telephonen){ telephoneno=telephonen; } void setNiccardno(string niccardn){ niccardno=niccardn; } void setStreetno(string streetn){ streetno=streetn; } string getName(){ return studentname; } string getfathername(){ return fathername; } string getAddress(){ return address; } string getTelephoneno(){ return telephoneno; } string getNiccardno(){ return niccardno; } string getStreetno(){ return streetno; } }; int _tmain(int argc, _TCHAR* argv[]) { Student s1,s2,s3; s1.setName("Peter"); s1.setfathername("Peter"); s1.setAddress("WS"); s1.setTelephoneno("0215554545"); s1.setNiccardno("Peter1"); s1.setStreetno("55"); s2.setName("Bred"); s2.setfathername("Pit"); s2.setAddress("DC"); s2.setTelephoneno("1254565654"); s2.setNiccardno("Pit1"); s2.setStreetno("323"); s3.setName("Pen"); s3.setfathername("Peter"); s3.setAddress("NWS"); s3.setTelephoneno("4546898774"); s3.setNiccardno("Pen1"); s3.setStreetno("65"); cout<<"Press enter to see information about student\n"; getch(); cout<<"Name: "<<s1.getName()+"\n"; cout<<"Father name: "<<s1.getfathername()+"\n"; cout<<"Address: "<<s1.getAddress()+"\n"; cout<<"Telephone number: "<<s1.getTelephoneno()+"\n"; cout<<"Nick card number: "<<s1.getNiccardno()+"\n"; cout<<"Street number: "<<s1.getStreetno()+"\n"; cout<<"Name: "<<s2.getName()+"\n"; cout<<"Father name: "<<s2.getfathername()+"\n"; cout<<"Address: "<<s2.getAddress()+"\n"; cout<<"Telephone number: "<<s2.getTelephoneno()+"\n"; cout<<"Nick card number: "<<s2.getNiccardno()+"\n"; cout<<"Street number: "<<s2.getStreetno()+"\n"; cout<<"Name: "<<s3.getName()+"\n"; cout<<"Father name: "<<s3.getfathername()+"\n"; cout<<"Address: "<<s3.getAddress()+"\n"; cout<<"Telephone number: "<<s3.getTelephoneno()+"\n"; cout<<"Nick card number: "<<s3.getNiccardno()+"\n"; cout<<"Street number: "<<s3.getStreetno()+"\n"; getch(); return 0; }
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Learn more about our help with Assignments:
C++
Comments
Leave a comment