Tuesday 15 March 2011

visual c++ - How to cin data to store in a struct defined in another header file? -



visual c++ - How to cin data to store in a struct defined in another header file? -

i working on homework , stuck @ place. helpful if help me this. using visual c++.

this header file class.

#ifndef caller_h #define caller_h #include <string> #include <time.h> #include "nodedata.h" using namespace std; class caller { private: int phone_number; void setphonenumber(){ int min = 300000; int max = 800000; phone_number = min + rand()%(max-min+1); } string callers_name; string message; }; #endif

i trying store string of name , message above header file getting error. have searched on google , 1 possible solution: "cin >> caller.callers_name;" still getting error. same "cin >> caller.message;".

int _tmain(int argc, _tchar* argv[]) { queuelist l; caller * caller = null; int choice; const int columnsize = 3; string columnnames[columnsize]; cout <<"\n\t\tanz phone call center simulation\n"; cout <<"\n\tpress 1 create phone call caller.\n"; cout <<"\tpress 2 receive phone call consultant.\n"; cout <<"\tpress 3 print callers.\n\tchoice: "; cin >>choice; if (choice == 1){ cout <<"\n\tplease leave name , message.\n"; cout <<"\tenter name: "; cin >> caller.callers_name; cout <<"\n\tmessage: "; cin >> caller.message; }else if (choice == 2){ } .............. system("pause"); homecoming 0; }

visual-c++

No comments:

Post a Comment