Brief history about me.
Hey, Kind of Noob and started programming recently.
My situation
I have a Text file that contain 7 questions and I want to read those questions from a text file, full lines not just Strings before SPACE.
The questions are being stored in a struct called Question.
Here is the Source Codes:
My Struct
Code:// Declaring and defining struct that has one member // struct Question { string Questiontxt; }; Question questions[MAXQUES];Actual code that writes first line:Code:// Reading Questions // ifstream quesf("questions.txt"); while (!quesf.eof()) { for (int i=0; i<MAXQUES; i++) { getline( quesf >> questions[i].Questiontxt)); } } quesf.close();
My Text File:Code:Gwin.writeString(235,310,questions[2].Questiontxt);
The result I am getting is ..:Code:In the United States, how much is a dime worth?How many inches are in a foot? Michael Jordan professionally played which of these sports? Where does the sun set? What is the meaning of bogus? What is the state pension age for men? Where does Santa Claus come from?
But I want it display full line of text. ie :from?
In the United States, how much is a dime worth?How many inches are in a foot?



LinkBack URL
About LinkBacks


