Question
1.
#include
2.
using namespace std;
3.
void PrintSequence(int StopNum)
4.
{
5.
int Num;
6.
Num = 1;
7.
while (true)
8.
{
9.
if (Num >= StopNum)
10.
throw Num;
11.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
void PrintSequence(int StopNum)
4.
{
5.
int Num;
6.
Num = 1;
7.
while (true)
8.
{
9.
if (Num >= StopNum)
10.
throw Num;
11.
cout
Answer: Option A
Was this answer helpful ?
Answer:c
Explanation:In this program, We are printing one and raising a exception at 2.
Output:
$ g++ gex4.cpp
$ a.out
1
exception: 2
Was this answer helpful ?
Submit Solution