visual c++ - saving data into a file c++ -
visual c++ - saving data into a file c++ -
i having hard time trying this, survey, people have reply 5 questions , answers(data) have save file.txt programme have read data.then, lets user answered first question has 20 out of number of people did survey answered (20/100) same other 5 questions. im kind lost dont know how create programme count how many people took survey , how store reply file. please help!
int questions = 1; char answer; (int = 0; < questions; i++){ cout << "\t1 - kind of phone prefer? " << endl; cout << "\n"; cout << "\ta) iphone b) android c) windows d) other" << endl; cout << "\n"; cout << "\tanswer: "; cin >> answer; cout << "\n"; cout << "\t2 - favorite flavor? " << endl; cout << "\n"; cout << "\ta) chocolate b) vanilla c) strawberry d) other" << endl; cout << "\n"; cout << "\tanswer: "; cin >> answer; cout << "\n"; cout << "\t3 - favorite sport? " << endl; cout << "\n"; cout << "\ta) baskteball b) baseball game c) hokey d) football" << endl; cout << "\n"; cout << "\tanswer: "; cin >> answer; cout << "\n"; cout << "\t4 - favorite animal? " << endl; cout << "\n"; cout << "\ta) cat b) dog c) bird d) other" << endl; cout << "\n"; cout << "\tanswer: "; cin >> answer; cout << "\n"; cout << "\t5 - favorite season of year? " << endl; cout << "\n"; cout << "\ta) summer b) winter c) spring d) autumn" << endl; cout << "\n"; cout << "\tanswer: "; cin >> answer; cout << "\n"; } system("pause"); homecoming 0; }
google search "c++ write file". first hit: http://www.cplusplus.com/doc/tutorial/files/
this should reply questions this.
short outline:
you can handle file cout. open , write file output stream.
reading described there.
but: seems don't have solution in mind. write in natural languge step step description of whole process. note should written in file can read afterwards. may useful see task little bit clearer.
you noticed downvotes? got them because have solved 5secs googling, problem description unclear , begged help (we here helping).
i recommend read this: https://stackoverflow.com/help/how-to-ask
c++ visual-c++
Comments
Post a Comment