console app
Aug 16, 2014 at 7:20am UTC
Hello
This program is not implemented?
If the
do-while(); Put, and the error is still not implemented.
Why is that?
Where is the problem?
Please help me.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b;
cout<<"please inter 1 integer : " ;
cin>>a;
do
{
b=a%10;
a/=10;
cout<<b;
}
while (a>9)
{
b=a%10;
a/=10;
cout<<b;
}
if (a>0)
{
cout<<a;
}
cout<<"\npress any key to exit." ;
getch();
}
Aug 16, 2014 at 7:38am UTC
This doesn't mean anything:
1 2 3 4 5 6 7 8 9 10 11 12
do
{
b=a%10;
a/=10;
cout<<b;
}
while (a>9)
{
b=a%10;
a/=10;
cout<<b;
}
You can either have
1 2 3 4 5 6 7
do
{
b=a%10;
a/=10;
cout<<b;
}
while (a>9); // <- Note semicolon
which checks the condition at the end (in other words, the loop runs at least once no matter what), OR
1 2 3 4 5 6
while (a>9) // <- Note no semicolon
{
b=a%10;
a/=10;
cout<<b;
}
which checks the condition at the start (the loop may not run at all).
Aug 16, 2014 at 8:00am UTC
first studies programming language?
Topic archived. No new replies allowed.