What happens when you attempt to compile and run the following code?
#include
using namespace std;
int main(){
int i = 1;
if (--i==1) {
cout << i;
} else {
cout << i-1;
}
return 0;
}
What happens when you attempt to compile and run the following code?
#include
using namespace std;
class First
{
public:
void Print(){ cout<<"from First";}
};
class Second:public First
{
public:
void Print(){ cout<< "from Second";}
};
void fun(First *obj);
int main()
{
First FirstObject;
fun(&FirstObject);
Second SecondObject;
fun(&SecondObject);
}
void fun(First *obj)
{
obj?>Print();
}
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int mul (int a, int b=2)
{
int r;
r=a*b;
return (r);
}
int main ()
{
cout << mul(1) << mul(2,4);
return 0;
}
What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
int f(int i);
int main()
{
int i=0;
i++;
for (i=0; i<=2; i++)
{
cout<<f(i);
}
return 0;
}
int f(int a)
{
return a+a;
}