473,412 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

beginner stuff,bloodshed dev C++

when I compile I get a few errors.. is there a way
to set up the settings to show what SHOULD be there
to make it right?? it just says the standard error
messages...When possible it would be nice to see at
least some suggestions to fix it. thanks
Jul 21 '07 #1
7 2062
when I compile I get a few errors.. is there a way
to set up the settings to show what SHOULD be there
to make it right?? it just says the standard error
messages...When possible it would be nice to see at
least some suggestions to fix it. thanks
added info DEV C++ 4.9.9.2
Jul 21 '07 #2
ilikepython
844 Expert 512MB
when I compile I get a few errors.. is there a way
to set up the settings to show what SHOULD be there
to make it right?? it just says the standard error
messages...When possible it would be nice to see at
least some suggestions to fix it. thanks
I dont think so. However, you can figure out what should be there either by spotting the error or doing a little research.
Jul 21 '07 #3
int main()
{
int number=rand()%100;
int
guess=-1;
int trycount=0;
while(guess!=number && trycount<8)

{
cout<<"Please enter a guess: ";
cin>>guess;

if(guess<number)
cout<<"Too low"<<endl;

if(guess>number)
cout<<"Too high"<<endl;

trycount++;
}
if(guess==number)
cout<<"You guessed the
number";}
else
cout<<"Sorry, the number was:
"<<number;
return 0;
}

what do you see wrong here?
Jul 22 '07 #4
weaknessforcats
9,208 Expert Mod 8TB
You will get the the same number from rand() each time.

Also, this code:
if(guess==number)
cout<<"You guessed the
number";} <<<<<<<<??
else
cout<<"Sorry, the number was:
"<<number;
looks like it has unbalanced braces.

I would code it as:

Expand|Select|Wrap|Line Numbers
  1. if(guess==number)
  2. {
  3. cout<<"You guessed the
  4. number";
  5. }
  6. else
  7. {
  8. cout<<"Sorry, the number was:
  9. "<<number;
  10. }
  11.  
This way there is no confusion.

Also, you have literals spanning lines. For example,
cout<<"You guessed the
number";
and that won't compile in C++. You can continue a litreral from one line to the next but you have to have each section with it's own double quotes:
Expand|Select|Wrap|Line Numbers
  1. [quote=scrip99]
  2. cout<<"You guessed the"
  3. "number";
  4.  
Jul 22 '07 #5
compman9902
105 100+
How long have you been programming with any compiler anyways?
Jul 22 '07 #6
not long doesnt matter
Jul 22 '07 #7
compman9902
105 100+
It dosn't (sorry for posting on unrelated maters), but I was just confirming a suspicion.
Jul 22 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Shawn | last post by:
I just finished my second C++ book and I feel like I am ready to learn some more. I have read alot so that I hope I don't sound ignorant when I come here but sometimes all the googling in the world...
3
by: IS | last post by:
I'm using BloodShed DevC++. If you know the program that would be great. Here is what I'm doing: File>New>Source File. Then I enter: #include <iostream.h> int main();
9
by: Steve | last post by:
Hi, I am completely new to C++. I have good experience in Java, VB and some experience in C (as well as a few other languages). Bearing in mind my experience - - What would be the most...
28
by: angeluslii | last post by:
Which IDE would you recommend for a beginner doing C programming possibly one which would work with Windows Vista and does syntax highlighting?
30
by: Dave -Turner | last post by:
So I just downloaded Bloodshed devcpp, opened up the Hello example, compiled it, no problems ..... well, except one - the exe is 474,990 bytes! What's the secret to compiling small exes? Thanks
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.