Q:Write a program that prints the numbers 1 to 4 on the same line with
with each pair of adjacent numbers separated by one space. Do this
several ways:
a) Using one statement with one stream insertion operator.
b) Using one statement with four stream insertion operators.
c) Using for statement
my answers are as follow
a)
{
std::cout << "1 2 3 4";
system("PAUSE");
return 0;
}
b)
{
std::cout << "1" << " 2" << " 3" << " 4";
system("PAUSE");
return 0;
}
c)
{
std::cout << "1";
cout << " 2";
cout << " 3";
cout << " 4";
system("PAUSE");
return 0;
}
i don't know this answer is right or not
if right
how can be more simple for this question?