Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

C++ When my code asks for my full name it only gets my first name and not last

$
0
0

Hello I am new to C++ and when I tried to make my code ask for my full name and then print it, it only displayed my first name. Here is an example of my code:

#include <iostream>
#include <string>

using namespace std;

int main()
{
	string fullname;
	cout << "What is your full name?" << endl;
	cin >> fullname;
	cout << "Hello " << fullname << endl;
}

It would then only show Billy if my name was Billy Bob Joe. How do I make it to where my full name is shown?


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>