0

Guys what's wrong in my code ? i tried to use cin.ignore but it's not working

https://code.sololearn.com/cNw23JNnc6q3/?ref=app

19th Nov 2021, 2:22 PM
Bruce Daine M. Sison
Bruce Daine M. Sison - avatar
1 Respuesta
0
I made this solution that works... #include<iostream> #include<cstdlib> #include<string> using namespace std; int main() { string lname ,fullname, middle; char fname[20], address[20]; int cpnum, byear, age; cout << "Input Last Name: "; cin >> lname; getchar(); cout << "Input First Name: "; cin.getline(fname, 20); cout << "Input Middle Initial: "; cin >> middle; getchar(); cout << "Input Address: "; cin.getline(address, 20); cout << "Input Contact Number: "; cin >> cpnum; cout << "Input Birth Year: "; cin >> byear; fullname = fname+middle+lname; age = 2021-byear; cout << endl << endl; cout << "Full name: " << fullname << endl; cout << "Address: " << address << endl; cout << "Contact Number: " << cpnum << endl; cout << "Birth Year: " << byear << endl; cout << "Age: " << age << endl; return 0; }
19th Nov 2021, 3:32 PM
Jan
Jan - avatar