Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Put the following line in a file called data.txt without comment markers:
- // MyName 42
- //
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main() {
- ifstream input;
- input.open("data.txt");
- char name[100];
- int grade;
- input >> name >> grade;
- cout << "Name: " << name << endl;
- cout << "Grade: " << grade << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement