1 Replies - 1144 Views - Last Post: 23 November 2001 - 01:27 AM Rate Topic: -----

#1 dougle  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 22-November 01

My stupid program wont work :(

Posted 22 November 2001 - 03:03 AM

What is wrong with this code? It is supposed to ask for a number and the reverse it e.g 12345 becomes 54321:

#include <iostream.h>

int main()
{
int number, calc;

cout<<"Type your number: ";
cin>>number;
cout<<"
That number reversed is: ";

do
{
calc = 10 * m + n % 10;
number = calc /10;
}while(n != 0)

cout<<"calc";

return 0;
}

any help would be great:)


Is This A Good Question/Topic? 0
  • +

Replies To: My stupid program wont work :(

#2 Null and Void  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 204
  • Joined: 29-April 01

Re: My stupid program wont work :(

Posted 23 November 2001 - 01:27 AM

Where are "m" and "n" declared? There should be a semicolon after the while(...). Also, your last cout statement shouldn't have quotation marks. I haven't checked the logic behind your program, but remember to take operator precedence into account.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1