I got some problem in c++

please can someone help me, i have no idea where am i wrong

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
using namespace std;
int main()
{
	float a1, b1;
	cout << "Enter the number you want to sum" << endl ;   
        //[Error] 'cout' was not declared in this scope 
        //[Error] 'endl' was not declared in this scope 

	cout << "             a = " ;
	cin >> a1 ;
        //[Error] 'cin' was not declared in this scope 

	cout << "             b = " ;
	cin >> b1 ;
	cout << "            a + b ="<< a1 + b1 ;
	getchar () ;
        //[Error] 'getchar' was not declared in this scope 

	getchar () ;
	return 0;
}
#include <stdio.h>

Should make the getchar() work.

As for cin, cout and endl they all compile for me with code::blocks console c++ project.

Use all these at a time .... If there are extras .. it is ok ... but if there as less .. then there are errors..hope you get that.. good luck

And if you only want to use iostream.h .. then for getchar(); .. you may use getch();

For others you will surely need stdio.h

1
2
3
4
5
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<math.h>
#include<string.h> 
Topic archived. No new replies allowed.