|
-
November 4th, 2010, 09:47 PM
#1
C++ arrays and files
I am doing a project and I have to read from a file and input the values into an array. I know how to do this. But now we have to read from a file in put it in multiple arrays. The file that I'm reading looks like this:
4
Assign1 200 95
Assign2 100 80
Project 100 -1
Midterm 100 -1
How would I make it so that the names are put into one array, the 1st numbers in another, and the last numbers in another array?
Code:
Code:
int readFile(char fileName[])
{
int i = 0;
ifstream input;
input.open(fileName);
while (i != input.eof())
{
input >> grade[i];
i++;
}
input.close();
}
How do I make it so the information is stored into 3 different arrays
Last edited by prestonprice57; November 4th, 2010 at 10:37 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|