okay so im almost completely new to C++ my trouble is one of the first parts of it for storing variables. (feel free to correct me if i say anything that is incorrect this is just what i understand).
there are different types of syntaxes for storing variables int is for a number without a decimal char is for a letter and theres another one but i dont understand it i think its called float.
im trying to make my first simple program where it would give the "illusion" that your talking to me for example i'd ask what your name is then youd type it in and i'd give a response to it.
i guess im not using the right syntax or something because when the user is entering their name it closes the program like when it's done loading everything.
here is my code if someone could point out what to change:
Code:
#include <iostream>
using namespace std;
int main()
{
char name;
int age;
cout<<"hi my name is daniel, whats yours?\n";
cin>> name;
cin.ignore();
cout<<"pleasure to meet you "<< name <<"\n";
cout<<"im 15, how old are you?\n";
cin>> age;
cin.ignore();
cout<<" "<< age <<" years old? awesome!\n";
cin.get();
return 0;
}
originally i had:
as:
when i realized that int was a syntax for a number not a word so i tried looking for what the syntax for storing a word variable would be but couldnt find anything specificly saying use this one =p so then i guessed at char