cout Returns weird number

My problem is that when I use this source code below my answer is always the same weird negative number even though the user inputs something else. Am I missing something?


P.S. The output gives this and its never happened before-------

'program1.exe': Loaded 'C:\Users\admin\Documents\Visual Studio 2010\Projects\program1\Debug\program1.exe', Symbols loaded.
'program1.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'program1.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'program1.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'program1.exe': Loaded 'C:\Program Files\Alwil Software\Avast5\snxhk.dll', Cannot find or open the PDB file
'program1.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'program1.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'program1.exe': Loaded 'C:\Windows\SysWOW64\apphelp.dll', Cannot find or open the PDB file
'program1.exe': Loaded 'ImageAtBase0x4a910000', Loading disabled by Include/Exclude setting.
'program1.exe': Unloaded 'ImageAtBase0x4a910000'
The program '[2412] program1.exe: Native' has exited with code 0 (0x0).


********************************************************************************

#include <iostream>


using namespace std;

int main()
{int User;

cout << "Please enter Username"<<endl;

cin>> User;

cout<< User;



return 0;
}

*****************************************************************************
Last edited on
As the name implies, int variables can only store integers.
If you want to store a string, use the string data type (you'll need to include <string>).
Oh, ok I get the string include but then what goes in place of the int user; ?

is it string user; or something else?
Last edited on
Yes, it's string user;
Ok thank you it works perfectly now!
Last edited on
Topic archived. No new replies allowed.