I have to call in two files, both have 20 letters in them. my program needs to be able to handle up to 50 chars and stop at the blank space.
i need help getting the chars into the array and stopping at blank space
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream inFile("student.txt");
ifstream infile("correct.txt");
const int questions=50;
char student[questions];
char correct[questions];
int i;
int count=0;
for(count=0; count<questions; count++)
{
for (i=0; i<questions; i++)
{
inFile >> student[i];
if (inFile)
count++;
}
}
for (i=0; i<(count-1); i++)
{
cout << student[i] << endl;
}
inFile.close();
infile.close();
return 0;
}