ASSIGNMENT 02
[Document subtitle]
Contents
Ans1:......................................................................................................................................................2
Ans2:......................................................................................................................................................2
Ans3:......................................................................................................................................................3
Ans4:......................................................................................................................................................4
Ans5:......................................................................................................................................................5
Ans1:
Code
#include <iostream>
using namespace std;
int a = 10;
int main() {
int big = 980000;
short small;
cout << "big=" << big << endl;
small = big; //don't do this
cout << "small=" << small << endl;
cin >> a;
return 0;
}
Output:
Jlskdjflkasjdlfjsd ljlkjlkjlkjl lkjlkjlk
Figure 1: Output of Question 1
Ans2:
Code
#include <iostream>
using namespace std;
int a = 10;
int main() {
int big = 980000;
short small;
cout << "big=" << big << endl;
small = big; //don't do this
cout << "small=" << small << endl;
cin >> a;
return 0;
}
Output:
Jlskdjflkasjdlfjsd ljlkjlkjlkjl lkjlkjlk
Figure 2: Output of Question 1
Ans3:
Code
#include <iostream>
using namespace std;
int a = 10;
int main() {
int big = 980000;
short small;
cout << "big=" << big << endl;
small = big; //don't do this
cout << "small=" << small << endl;
cin >> a;
return 0;
}
Output:
Jlskdjflkasjdlfjsd ljlkjlkjlkjl lkjlkjlk
Figure 3: Output of Question 1
Ans4:
Code
#include <iostream>
using namespace std;
int a = 10;
int main() {
int big = 980000;
short small;
cout << "big=" << big << endl;
small = big; //don't do this
cout << "small=" << small << endl;
cin >> a;
return 0;
}
Output:
Jlskdjflkasjdlfjsd ljlkjlkjlkjl lkjlkjlk
Figure 4: Output of Question 1
Ans5:
Code
#include <iostream>
using namespace std;
int a = 10;
int main() {
int big = 980000;
short small;
cout << "big=" << big << endl;
small = big; //don't do this
cout << "small=" << small << endl;
cin >> a;
return 0;
}
Output:
Jlskdjflkasjdlfjsd ljlkjlkjlkjl lkjlkjlk
Figure 5: Output of Question 1