• Advertisement

Archived

This topic is now archived and is closed to further replies.

Please help me out with my program

This topic is 5512 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m working with Dev-c++ 4.0. [/source] #include <stdio.h> #include <iostream.h> #include <conio.h> #include <stdlib.h> int main(int argc, char *argv[]) { (float) ''num'' = 2.5 (float) ''numb'' = 0.5 (cout) << "numb + num" << endl; getchar () ; return 0; } When I compile it says: parse '')'' how do I fix this?

Share this post


Link to post
Share on other sites
Advertisement
why do you put () around your variables and cout?

variable declaration:
float num = 2.5;
text output:
cout << numb + num << endl;



Runicsoft -- latest attraction: obfuscated Brainfuck Interpreter in SML

This post was made entirely from re-cycled electrons

Share this post


Link to post
Share on other sites
I have to or else it will give me an error message. Is there any other free IDE thats good

Share this post


Link to post
Share on other sites
I''ve been using Dev-C++ 4.9.something and I haven''t had any problems with declaring variables the right way. I would imagine that the compiler would get confused if you said something like (float) foo; because that looks like you''re casting foo as a float... but I could be wrong.

Share this post


Link to post
Share on other sites
I used DevC++ 4 as well and the following code worked. I would suggest that you do some more reading or at least look at some sample code before you continue coding anything else.


      
#include <stdio.h>
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
float num = 2.5;
float numb = 0.5;

cout << "numb + num = " << numb+ num <<endl;


getchar() ;

return 0;
}




[edited by - yspotua on January 17, 2003 8:48:22 PM]

[edited by - yspotua on January 17, 2003 8:49:11 PM]

Share this post


Link to post
Share on other sites
You might want to remove the ' ' around your variable names, too. It's no surprise that the way you're doing it won't compile; both the parentheses and the single quotes are obvious syntax errors.

EDIT: And remove the quotes around numb + num.

EDIT 2: And add a semicolon after each variable declaration.

[edited by - micepick on January 17, 2003 9:19:51 PM]

Share this post


Link to post
Share on other sites

  • Advertisement