473,386 Members | 1,720 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,386 software developers and data experts.

basic code not working

int main()
{
int number=rand()%100; // rand undecl/?
int
guess=-1;
int trycount=0;
while(guess!=number && trycount<8)

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

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

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;
} // expected `}' at end input/?


here is what the compiler is saying is wrong.the // is just
comments from the compiler... trying to get the basics and get to recognize them quickly...thanks for the help..
Jul 26 '07 #1
5 1205
ravenspoint
111 100+
Add the following line at the top of your code:

#include <iostream>
Jul 26 '07 #2
Add the following line at the top of your code:

#include <iostream>
yea but still coming back with same errors.
Jul 26 '07 #3
gpraghuram
1,275 Expert 1GB
yea but still coming back with same errors.
What header files you have included in your code?
If u have included iostream have used the statement using namespace std;

I think u have missed the inclusion of stdlib.h which is required for rand.


Raghuram
Jul 26 '07 #4
line 8 while (guess! etc

says expexted unqualified id before "while"

what is it ?????
Jul 27 '07 #5
gpraghuram
1,275 Expert 1GB
line 8 while (guess! etc

says expexted unqualified id before "while"

what is it ?????
Can u post ur full code with tags so that it is easier for us to understand the code.
Also add a comment in the lines where u are getting the error.

Raghuram
Jul 27 '07 #6

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

Similar topics

7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
56
by: Dave Vandervies | last post by:
I just fixed a bug that some of the correctness pedants around here may find useful as ammunition. The problem was that some code would, very occasionally, die with a segmentation violation...
13
by: usenet | last post by:
How and where can one find out about the basics of VB/Access2003 syntax? I am a died in the wool C/C++/Java Linux/Unix programmer and I am finding it difficult to understand the program format...
1
by: JohnSmith | last post by:
I am working on a tuturial that i have for Visual basic.net ( for now ) I am working with Visual Studio 2005. I have been working on a code to change the text color by the name put into the...
97
by: Master Programmer | last post by:
An friend insider told me that VB is to be killled off within 18 months. I guess this makes sence now that C# is here. I believe it and am actualy surprised they ever even included it in VS 2003 in...
0
by: =?Utf-8?B?S29uc3RhbnRpbg==?= | last post by:
I am currently working on the application that need to simulate basic authentication programmatically using user's credentials that are known. Basically, the need is for a single sign on with a...
6
by: Simon Walsh | last post by:
I'm an Electronics student in college and I'm currently working on a project. I was given a circuit diagram for my project, from which I had to design a printed circuit board to be sent off and...
28
by: Randy Reimers | last post by:
(Hope I'm posting this correctly, otherwise - sorry!, don't know what else to do) I wrote a set of programs "many" years ago, running in a type of basic, called "Thoroughbred Basic", a type of...
4
by: Goran Djuranovic | last post by:
Hi all, I am experiencing a strange thing happening with a "designer.vb" page. Controls I manually declare in this page are automatically deleted after I drop another control on a ".aspx" page. -...
14
by: MartinRinehart | last post by:
Working on parser for my language, I see that all classes (Token, Production, Statement, ...) have one thing in common. They all maintain start and stop positions in the source text. So it seems...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.