Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.140.198.201
Web Server : Apache
System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.2.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0705) :  /home/kebuck/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/kebuck/test_string.cpp
//
//	Goal: Test string input using getline(cin, str)
//	IT CAN read any string
//

#include <iostream>

using namespace std;

int main()
{
	string fullname;
	string fullname2;
	string age;
	string major;

	cout << "What is your name? ";
	getline(cin, fullname);

	cout << "What is your boyfriends name? ";
	getline(cin, fullname2);

	cout << "How old is he? ";
	getline(cin, age);

	cout << "What is his major? ";
	getline(cin, major);

	cout << "My name is " << fullname << endl;
	cout << "My boyfriends name is " << fullname2 << endl;
	cout << "He is " << age << endl;
	cout << "He is majoring in " << major << endl;

	return 0;
}

Stv3n404 - 2023