Haha, I posted this a couple of minutes ago.. but forgot the
link to the code.
So basically, I have written this code that
will let a user choose 2 numbers.
the program will either
1: Tell the user all of the odd numbers between the first number
and second.
or
2: Write the odd numbers to a file, "odds.txt".
This can be found at
seklym4.t35.com/odds.txt
I can't find out what could be wrong with it, but there definately
*is* something.
I use Bloodshed Dev-C++, just in case my code won't
compile in your compiler.
Please, could you revise the code, and post it, or at least just
tell me what I need to change to make it work.
Any help would be greatly appreciated.
C++ program, it just won't work.?
Incorrect CODE
goto end;
}
}
else if ( yesno == "no" || "n"){
if ((start %26amp; 1) != 0 %26amp;%26amp; start != end){
start++;
for( int start; start %26lt;= end; start += 2){
cout%26lt;%26lt; start;
}
}
else if ((start %26amp; 2) != 0 %26amp;%26amp; start != end){
for( int start; start %26lt;= end; start += 2){
cout%26lt;%26lt; start;
}
}
else if ( start == end ){
cout%26lt;%26lt;"There are no odds between "%26lt;%26lt; start %26lt;%26lt;" and "%26lt;%26lt; end %26lt;%26lt; endl;
goto end;
}
else {
cout%26lt;%26lt;"That's an invalid function.. Thanks for playing though";
goto end;
}
}
else{
count%26lt;%26lt;"That's an invalid function.. Thanks for playing though";
}
end:
system("pause");
}
Its not cout its count i fixed it..
this
cout%26lt;%26lt;"That's an invalid function.. Thanks for playing though";
Name cout name it count
Reply:edit:
Next step, learn to use the debugger.
The following lines are wrong:
if ((start %26amp; 2) != 0
should be
if ((start %26amp; 1) == 0)
(2 occurences of that).
if ( yesno == "no" || "n")
should be
if ( yesno == "no" || yesno == "n")
|
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment