Q BgQuestion:

      
Rookie
Karma Points: 10
(Kingsborough Community College of the City University of New York)
Respect (100%):
posted by  Lithius on 11/6/2009 2:43:13 AM  |  status: Closed  |  Earned Karma: 10

help find my bug plz

Course Textbook Chapter Problem Needs by
Data Structures Starting Out with C++: From Control Structures Through Objects (6th) by Gaddis N/A N/A 11/9/2009 at 11:00:00 PM
Question Details:
SO I keep getting an error and this and cant figure out where it is, it's not a final product but working on it

#include<iostream>
#include<cmath>

using namespace std;

int main()
{double num,rem,digits,bin,x;
cout<<"Enter a number between 100 and 500 and I will convert it to binary\n";
cout<<"If you would like to exit simply enter a number less than zero\n";
cin>>num;
{if (num<100||num>500)
cout<<"invalid entry please try again\n";
if (num>=100&&num<=500)
 
do
{(rem=num/2);
digits++;
bin=x(pow(10.0,digits);}
while(rem>0;
if(num<0)
}

system("pause");
return 0;
Do or do not there is no try

AAnswers:

Answer Question Ask for clarification
Oracle
Karma Points: 31,807
posted by rapunzel on 11/6/2009 7:12:11 AM  |  status: Live
Asker's Rating: Lifesaver   
Response Details:
please rate - thanks

this should get you started

#include<iostream>
#include<cmath>

using namespace std;

int main()
{int num,rem,digits,bin,x;
cout<<"Enter a number between 100 and 500 and I will convert it to binary\n";
cout<<"If you would like to exit simply enter a number less than zero\n";
cin>>num;
{if(num<0)
    {system("pause");
     return 0;
     }
 else  if (num<100||num>500)
     cout<<"invalid entry please try again\n";
 else if (num>=100&&num<=500)
    {digits=-1;
     do
      {rem=num%2;
       digits++;
       bin=rem*(pow(10.,digits));
       num=num/2;
       }while(num>0);
      }

}
}



Note to all members 1. Please 1 question per post 2. Show respect to your fellow members by rating all answers. 3. When rating remember that the first answer is not necessarily the best answer. 4. When answering questions, explain what you are doing, so that the asker will learn, don't just give a meaningless number. 5. Your answers should be your work. Don't copy from another member, this is Karma abuse and possible disciplinary actions against you. and GOOD LUCK to you all!!
Answer Question Ask for clarificarion

Join Cramster's Community

Cramster.com brings together students, educators and subject enthusiasts in an online study community. With around-the-clock expert help and a community of over 100,000 knowledgeable members, you can find the help you need, whenever you need it. Join for free today » How Cramster is different from tutoring »