So im trying to get better in this thing but i dunno what i did wrong, it lets me write in the firts cin part but when it gets to the getline part it dosnt work it just skips it, what did i do wrong?.
Ok. cin >> age gets the age digits from the keyboard but does NOT get the terminating newline. getline() then sees the newline from before and exists with out obtaining the name. There are various ways around this, but for a simple way try:
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
int age {};
string name;
cout << "Hallo " << endl;
cout << "Wie alt bist du?" << endl;
cin >> age;
cin.ignore();
cout << "Toll! Und wie alt bist du? :" << endl;
getline(cin, name);
cout << "Schön dich kennen zu lernen " << name << " !" << endl;
cout << age << " ist ein tolles alter! :) " << endl;
}
Note that this assumes that a valid number was entered for age. If an invalid number (eg contains non-digits) was entered, then the stream enters a 'fail state' and the following getline() will also fail.