Question #3819

How can I get user input in c++ to pass to a function that accepts char*? ie addRecord(char* lName, char* fName, char grade)

Expert's answer

#include <iostream>using namespace std;

void addRecord(char* lName, char* fName, char grade){
// addRecord method body
}
int main(int argc, char** argv)
{
char lName[20];
char fName[20];
char grade;

cout << "Enter 'lName'" << endl;
cin >> lName;

cout << "Enter 'fName'" << endl;
cin >> fName;

cout << "Enter 'grade'" << endl;
cin >> grade;
cout << lName;

addRecord(lName, fName, grade);
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS