Classroom Ass1
Classroom Ass1
Classroom Ass1
Titinic
i
123
3.92
Natnael
123
3.92
Natnael
20 20
16
15
Hello
Goodbye
One more time:
Hello
End of program.
17.What is the output of the following program after it
#include <iostream>
void figureMeOut(int& x, int y, int& z);
int main() {
using namespace std;
int a=10, b=20, c=30;
figureMeOut(a, b, c);
cout << “a= “<<a << ", " <<”b= “<< b << ", " << c;
return 0; }
void figureMeOut(int& x, int y, int& z) {
using namespace std;
cout <<”x= “<< x << ", " <<”y= “<< y << ", " <<”z=
“<< z << endl;
x = 1;
y = 2;
z = 3;
cout <<”x= “<< x << ", " <<”y= “<< y << ", " <<”z=
“<< z << endl;
}
x = 10, y = 20, z = 30
x = 1, y = 2, z = 3
a = 1, b = 20, 3
Wow
a) 2.0
b) 2.0
c) 0.86858895
d) 4.0
e) 3.0
f) 6.0
g) 8
0123456789
1 2 3 4 5 6 7 8 9 10
End
10, 1, 2, 3, 4, 5, 6, 7, 8, 9, End
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, End
0, 1, 2, 3, 4, 5, 6, 7, 8, End
1. Write a C++ program that accepts a long integer from the keyboard and displays
the number of digits to the screen. Implement the digit counter with a function taking
the number as an argument and returns the number of digits.
The output
2. Write a C++ program that accepts student’s name and father’s name; and prints
them in reverse order with a space between them
The code
The output