1.

Solve : C++ programing problem?

Answer»

#include
#include

int main()
{
int student;

{
COUT<<"pls enter the number 006006\n";
cin>>student;
cout< }
cout<
system("PAUSE");
return 0;
}
_______________________________________ ____________________________
elo guys..i have some problems regarding on the syntax above..the output that i am expecting on this program is "006006" w/out the quotes ofcors, but this doesnt show, insted the output is "6006"..this means that the integer 0 on the begining of the cin>> was not shown on the cout<<..can u pls give me the syntax needed?im very thankful in advance for UR help..this site is very helpful to newbies like me.. thanks a LOT..I dont think if you use integer, you will get 0s before the ORIGINAL no. in the result.
If you really want 0s to be displayed, then I think you can use a string.
Try it out.He's right. Leading zeros are ignored with ints. Strings work better for leading zeros, or you can add them yourself.#include
#include

using namespace std;

int main()
{
string students;
cout << "Enter AMOUNT of students: ";
getline(cin,students);

cout << "Students: " << students;
getchar();
}



Discussion

No Comment Found