- (10%)
Determine whether the following code is correct or not. If it is
correct, predict its output. If it is incorrect, point out the
mistake(s).
#include <iostream>
int main()
{
int a = 3;
int b = 0;
b = a++ * 3;
std::cout << a << ' ' << b << std::endl;
return 0;
}
- (10%)
Determine whether the following code is correct or not. If it is
correct, predict its output. If it is incorrect, point out the
mistake(s).
#include <iostream>
int main()
{
int a = 3;
int b = 0;
b = ++a * 3;
std::cout << a << ' ' << b << std::endl;
return 0;
}
- (10%)
Determine whether the following code is correct or not. If it is
correct, predict its output. If it is incorrect, point out the
mistake(s).
#include <iostream>
int main()
{
int i;
for (i=1; i<8; i++)
{
if (i>2)
{
if (i==3) continue;
if (i==5) break;
}
std::cout << i << std::endl;
}
return 0;
}