+ 10
Without using semicolon print hello in c++
in c++
10 Réponses
+ 7
Try putting the below code in the main function to print "Hello World..!" without using semicolon.
while(!(cout<<"Hello world..!!!"<<endl)){}
Looking forward for more inputs and clarifications if some one have.
+ 6
if u r joking then
"hello world..!" doesnt contain semicolon...!! so just print it out..!
if not then,
#include<iostream>
void main(){
while(!(std::cout<<"Helloworld..!"))
{}
}
In while loop there is "! "
that means while loop will continue till there is false ans. in condition.
but our condition is simple line, thats why it always returns " true".
Hence it will break in first attempt.
if there is no "!"
then condition is true evry time
and while loop will continue all the time for infinite iteration
though it will also print helli world but infinite times.
+ 4
#include<iostream
int main(){
while(!(std::cout<<"hello"))
{}
}
+ 2
A lot of fun here: The main question is how works if condition on cpp?
The second info is related to syntax on cpp a joke to strongly typed language every single line is terminated by semicolon.
But the dark side is strong on CodeLearn
#include <iostream>
int main() {
if( std::cout << "Hello Baby" ){}
}
+ 2
or...
1. Create a file contain the code you want.. including main()
2. Save the file with .h extention ( header)
3. Include that file in another .cpp file.
4. Compile and Run the .cpp
5. You are getting output just with the help of a header (without writing main() in cpp file)
ヽ(^。^)ノ
+ 2
if(cout<<"hello world")
this will work
+ 1
we can use the ASCII Numbers to print hello. just get the numbers and prints it in the form of characters using char data type.
0
#include <iostream>
using namespace std;
int main () {
if(cout<<"Hello World"){}
}
0
can anyone please help me get the logic behind this
:
if(cout<<"abc")
or
while(!(cout<<"abc"))
:
how are these printing without any semicolon??
- 2
not possible