+ 4
How to print "Hello World" without using a semicolon in the whole program?
Print "Hello World" without using a semicolon in the whole c++ program
22 Answers
+ 6
#include<iostream>
main(){
if(std::cout<<"hello")
{
}
}
use this code now it works
+ 4
I see I need to put on my hacker hat on. See you in a few hours.
Edit: guess I won't have to do anything because Mayur Chaudhari nailed it.
+ 3
if(cout<<Hello world){
}
//in if condition everything is accepted as true except 0
0 is consider as false
+ 3
@Blue I asked to ans it in c++
+ 3
@Adarsh Pathak It's just a fragment, full code would be
#include <iostream>
int main(){
if(std::cout<<"Hello World!"){}
}
+ 3
If u use int as a return type for main u need to use return 0; compulsorily which includes a semicolon
+ 3
now see my code
use only
main()
not need to use return 0;
it take main() by default data type is int
+ 2
@Mayur Chaudhari the given code isn't executable.
+ 2
use it as
+ 2
#include<iostream>
int main(){
if(cout<<"hello)
{
}
}
+ 2
wait i am share you code link
+ 2
N if u use void instead of int ur concept of if won't work@Mayur Chaudhari
+ 2
https://code.sololearn.com/ca8I3826RNaT/?ref=app
see this bro
+ 2
U used a semicolon buddy
+ 2
N if u use void instead of int ur concept of if won't work@Mayur Chaudhari
+ 2
You don't really have to use return in main in some compilers, like in SoloLearn's one.
+ 2
it work now see it plz
+ 2
I'd give a credit to you if your work wasn't so sloppy.
using namespace std;
+ 2
Awesome work @Mayur Chaudhari!!!
+ 2
Nice to see we arrived back at the solution we were 10 minutes ago.