very urgent pls help me....
How to retrieve even lines(questions) and odd lines(answers(true/false)) from text file into 2D string array in C
#include <string>
#include <fstream>
using namespace std;
int main()
{
ifstream infile("quizfile.txt");
string strings[10][10];
int i = 0;
string line;
while (std::getline(infile, line))
{
int row = i / 10;
int col = i % 10;
strings[row][col] = line;
i++;
if (i == 10 * 10)
{
break;
}
}
return 0;
}
Comments
Leave a comment