can someone tell me exactly what am i doing wrong in this program?
@imqwerty
The error log says in line 7, that there should be a filename after ``` #include ```
wait, how do i post my code on here?? i forgot
i tried *<iostream> * but it didn't work
```/************************************************* * Program to determine sum of two integer numbers* **************************************************/ //Header files #include #include using namespace std; int main() { //declare and initialize two integer numbers int first=50; int second=100; //declare integer type variable int total; //display both integer on screen cout<<"The first integer number:" <<first; cout<<"The second intefer number:" <<second; //determine sum of two intefer number total=first + second; //display sum on the screen "<<total<<endl; system ("pause"); return 0; }
Try getting rid of both ``` #include ``` And btw you write code like this: \``` #include \```
``` /************************************************* * Program to determine sum of two integer numbers* **************************************************/ //Header files #include #include using namespace std; int main() { //declare and initialize two integer numbers int first=50; int second=100; //declare integer type variable int total; //display both integer on screen cout<<"The first integer number:" <<first; cout<<"The second intefer number:" <<second; //determine sum of two intefer number total=first + second; //display sum on the screen "<<total<<endl; system ("pause"); return 0; } ```
Ahh thanks :)
uh.... try this instead ```c #include <iostream> using namespace std; ```
i did try to add <iostream> but it didn't work...let me do it again one sec plz
put a space between them like ```c #include <iostream> ```
oh ok
``` /************************************************* * Program to determine sum of two integer numbers* **************************************************/ //Header files #include <iostream> using namespace std; int main() { //declare and initialize two integer numbers int first=50; int second=100; //declare integer type variable int total; //display both integer on screen cout<<"The first integer number:" <<first; cout<<"The second intefer number:" <<second; //determine sum of two intefer number total=first + second; //display sum on the screen "<<total<<endl; system ("pause"); return 0; } ```
Do you have to use C? I went online and found this: https://stackoverflow.com/questions/30543286/fatal-error-iostream-no-such-file-or-directory-in-compiling-c-program-using-gc I'm not good with C or C++ so I'm not sure how they work
yeah i'm studying programming in cpp so yeah i'm stuck with code blocks for now
this dude: "30 Neither <iostream> nor <iostream.h> are standard C header files. Your code is meant to be C++, where <iostream> is a valid header. Use g++ (and a .cpp file extension) for C++ code. Alternatively, this program uses mostly constructs that are available in C anyway. It's easy enough to convert the entire program to compile using a C compiler. Simply remove #include <iostream> and using namespace std;, and replace cout << endl; with putchar('\n');... I advise compiling using C99 (eg. gcc -std=c99)"
Join our real-time social learning platform and learn together with your friends!