have a look at this, its not 100% specific but it should get you thinking of how to apply the same theory to the application your working on. main() { char s[1000]; char *lastline; while (!cin.fail()) { cin.getline(s, 1000); if (!cin.fail()) { lastline = s; } cout << "Reading... " << s << endl; } cout << "The last line was '" << lastline << "'" << endl; } Code (markup):
I am not 100% understanding what this code does. Could you explain it to me. I am suppose to write a function that that uses arrays and pointers to allows users to enter three students information and print what they have entered.
well you can have char arrays. You should use std::string unless you can't use that. (use using namespace std) To get text from user you can use cin >> string... or getline(cin,string); To output you use cout << string << endl;
why would you want to use pointers? pointers reveal the location in memory of said value just use stdio and gets()/puts()