- 2
#include <iostream> using namespace std; int main() { cout << "Hello world!"; return 0; }
When I enter this my laptop gives me 3 errors
17 Réponses
+ 5
First of all, don't use "using namespace std". Sololearn made a very very big mistake trying to teach people C++ with that piece of bad practice.
What it does is assumes everything with "cin" "cout" and other functions is in the standard library, when you can have similarly named functions from other libraries.
If you want to type "cout" or "cin" without needing the "std::" prefix, just put "using std::cout" and "using std::cin" at the top of your program.
The errors you're having, sounds like a compiler problem or syntax errors, either way, don't make a title your code, because we have no idea how you formatted the code itself now.
+ 3
Two cases are possible:
1) if you are doing programming in turbo C then include iostream.h and remove "using namespace std" statement because because turbo C uses older version of cpp and it requires .h extension and also it has no concept of namespaces.
2) and if you are using 32 bit compilers (g++) and ide's (codeblocks) then go to your compiler setting and enable either c++11 or c++14 standards because these standards have concept of namespaces and you need not to use .h extension with header files.
😊
+ 1
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
//your code goes here
return 0;
}
0
state the errors
0
CPP1: unable to open include file 'IOSTREAM'
CPP3: DECLARATION SYNTAX ERROR
CPP6:UNDEFINED SYMBOL 'COUT'
0
Are you even using a c++ compiler?
0
Replace "iostream" with "iostream.h"
And erase that second line "using.."
Check cout may be mistyped as Cout
0
Reinstall your compiler
0
#include <iostream>
using namespace std;
int main() {
// your code goes here
return 0;
}
0
#include <iostream>
using namespace std;
int main() {
//your code goes here
return 0;
}
0
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
0
#include<iostream>
using namespace std;
int main ()
{
Cin>a>b;
Cout<b;
Cin>>a+b;
Cuot<<"enter a'b";
Return 0;
}
0
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
//your code goes here
return 0;
}
0
#include<iostream>
int main()
{
int a=5;
int b=9;
cout<<((a==0) && (a>b))<<endl;
cout<<((a==0) && (a<b))<<endl;
cout<<((a==5) && (a>b))<<endl;
cout<<((a==5) && (a<b))<<endl;
return 0;
}
0
#include <iostream>
using namespace std;
int main() {
cout << "Hello, World!" << endl;
return 0;
}
0
#include<iostream>
int main()
{
int a=5;
int b=9;
cout<<((a==0) && (a>b))<<endl;
cout<<((a==0) && (a<b))<<endl;
cout<<((a==5) && (a>b))<<endl;
cout<<((a==5) && (a<b))<<endl;
return 0;
}
0
include <iostream>
using namespace std;
int main(){
cout << "Hello World";
return 0;
}