Troncoso
VIP Member
solved
i have this code:
but when I run it nothing is displayed except a blank line. There is a string in Grades.txt but its not assigning it to name1. What could be wrong?
EDIT: solved. When ever you name a text file, don't manually type in .txt, else you get this: Grades.txt.txt. haha
i have this code:
Code:
int main()
{
string name1, name2, name3;
string last1, last2, last3;
char letter1, letter2, letter3;
double grade1, grade2, grade3;
double s1, s2, s3, s4, s5, s6;
ifstream inFile;
inFile.open("c:\\Grades.txt");
inFile >> name1;
cout << name1 << endl;
return 0;
}
but when I run it nothing is displayed except a blank line. There is a string in Grades.txt but its not assigning it to name1. What could be wrong?
EDIT: solved. When ever you name a text file, don't manually type in .txt, else you get this: Grades.txt.txt. haha
Last edited: