Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #define NUM_PPL 2
- using namespace std;
- struct Person {
- char* name;
- double grade;
- };
- int main() {
- ifstream input;
- input.open("data.txt");
- Person** ppl = new Person*[NUM_PPL];
- for (int i=0; i < NUM_PPL; i++) {
- ppl[i] = new Person();
- ppl[i]->name = new char[80];
- input >> ppl[i]->name >> ppl[i]->grade;
- cout << "Name: " << ppl[i]->name << endl;
- cout << "Grade: " << ppl[i]->grade << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement