I am trying to get this program to take in three values from the users at different lengths each so like W3Schools.com says to do I put the variablename.length();
in the code to get the whole line entered by the User but it only works for one of them.
I have three of them if not more why does it only work so many times is there something I'm missing in the #include files
or something else. The code is pretty simple I thought I tried to go over it and make it as detailed as possible. Here is the code:
// CreateWriteDisplay.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <cstring>
#include <string>
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
void OpeningMessage() {
cout << "Enter Your First Name and Last name:";
cout << "Enter Your Age: ";
cout << "Enter Your Ocupation:";
cout << " This is yout Ocupation:";
}
int main()
{
OpeningMessage(), "\n";
int AccountAge;
string FullName;
string Ocupation;
cin >> AccountAge;
cin >> FullName;
cin >> Ocupation;
cout << FullName << FullName.length() << "\n";
cout << AccountAge << "\n";
cout << Ocupation << Ocupation.length();
return 0;
Also if anyone knows of anymore Tutorials like the W3Schools website I could really use the practice if you can't tell I am a beginner with C++ Programming. I did really good one the test on the first tutorial. I really enjoy this Language its reminds me a little of JavaScript but so much more powerful. So any help would be greatly appreciated. Thank You in advance.