What will be the output of the following C++ code?
#include <iostream>
int main(int argc, char const *argv[])
{
cout<<"Hello World";
return 0;
}
#include <iostream>
int main(int argc, char const *argv[])
{
cout<<"Hello World";
return 0;
}A. Hello World
B. Compile-time error
C. Run-time error
D. Segmentation fault
Answer: Option A
Solution (By Examveda Team)
The given code is a basic C++ program that prints a message to the console.It includes the <iostream> header, which allows the use of input and output streams like
cout.The main function is defined correctly with appropriate parameters (
int argc, char const *argv[]), though these parameters are not used.cout<<"Hello World"; correctly outputs the text "Hello World" to the standard output.There are no syntax or runtime errors in the code, and it will compile and run successfully.
Therefore, the output will be: Hello World
Join The Discussion
Comments (1)
Related Questions on Introduction to C plus plus
What does the 'cin' object in C++ represent?
A. File output stream
B. File input stream
C. Standard output stream
D. Standard input stream

Plz give description for coding problems.