Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Basic c++


ghost's Avatar
0 0

Resource file Icon file not found (please change it in Project Options)

I'm learning c++ and this is a very simple program i wrote.

// using variables

#include <iostream> using namespace std;

int main () { short int a, b , c, result; a = 7 b = 8 c = 15 result = a + b - c } if (result = 1) { cout << " you are wrong" << end1; { } else { cout << "you are correct" << end1; } return 0; {

when i tried to compile and run it this came up; Resource file Icon file not found (please change it in Project Options)

Im using dev - c++ 4

naw its not working..im screwing around with project options but its still not working


ghost's Avatar
0 0

Haven't used Dev C++, but I'm gonna take a stab at it and say that you need to check your Project Options. Does your "Hello World" prog have a GUI with it, or is it a command-line prog? If it has a GUI, I'd say that your prog is having a problem with an icon on the GUI. If not… still, fish a bit in the Project Options, and I'm sure you'll find something.

Edit: When I programmed in C++ in high school, I don't recall having to use "using namespace std;" when doing this type of prog. As far as I can remember, iostream covers it.


ghost's Avatar
0 0

The inclusion of the standard input/output header file (for C++) doesn't "cover" it. If you want an explanation, I'd be happy to provide one, but a simple google can resolve this concern.

~T


ghost's Avatar
0 0

im screwing around with project options but its still not working


ghost's Avatar
0 0

dude go with Borland C++ its very powerful command line compiler (if you dont mind a little command prompt action) and after compiling you dont have ANY extra files that you have to drag around just the .exe; except if you make your own #include files but thats a ways off…so ya google man……peace


Uber0n's Avatar
Member
0 0

oblivionprogrammer wrote:

// using variables

#include <iostream> using namespace std;

int main () { short int a, b , c, result; a = 7 b = 8 c = 15 result = a + b - c if (result == 1) { cout << " you are wrong" << endl; } else { cout << "you are correct" << endl; } return 0; }

There were some errors, I've fixed them and marked with red :p I also removed some stuff; the main function was ended in the middle of the code ^^


ghost's Avatar
0 0

thanks uber..i got rid of version 4 and got 5..now i dont have that problem…but there are some scripting errors even with ubers help but i think i can fix them… ty guys


ghost's Avatar
0 0

Uber0n wrote: [quote]oblivionprogrammer wrote:

// using variables

#include <iostream> using namespace std;

int main () { short int a, b , c, result; a = 7; b = 8; c = 15; result = a + b - c; if (result == 1) { cout << " you are wrong" << endl; } else { cout << "you are correct" << endl; } return 0; }

There were some errors, I've fixed them and marked with red :p I also removed some stuff; the main function was ended in the middle of the code ^1

Uber, you forgot something :P I marked it with lime :)


  1. /quote 


ghost's Avatar
0 0

There shouldn't be any problems unless you created a Win32 GUI project, and in that case it will be trying to search for a different entry point (WinMain()).

#include &lt;iostream&gt;

using std::cout;
using std::endl;

int main ()
{
short int a=7, 
          b=8, 
          c=15,
          result;

(!(result = a+b-c)) ? cout &lt;&lt; &quot;you are correct&quot; &lt;&lt; endl : cout &lt;&lt; &quot;you are wrong&quot; &lt;&lt; endl;

return 0;
}

ghost's Avatar
0 0

Zephyr_Pure wrote: Edit: When I programmed in C++ in high school, I don't recall having to use "using namespace std;" when doing this type of prog. As far as I can remember, iostream covers it. Long time since I've touched C++, but wont you have to write "std::cout" instead of "cout" if you omit using the std namespace?


ghost's Avatar
0 0

Like I said… long time since I've used C++… I only threw that out there in case it might help. Obviously, there are people more knowledgable about that subject than me, so I will leave it to them. ;)