Pre-Lab - Lab (5)



Answer the following questions in writing.

1) When you enter a value to your program from the keyboard, it is temporary.  The number can disappear or will no longer be accessible once you have pressed enter.  Also, what you display on the screen will disappear once you move to another stage or when you logout of the system.  What can you do to make the input and/or the output permanent.
 
 
 
 
 

2) Explain what the following code segment will do.  What would be the output when we enter: 2 3 4 5?

int x;
while(cin >> x)
{
     cout << x << endl;
}
 
 
 
 
 

3) Explain what the following code segment will do.  What would be the output when we enter: A B C D?

char c;
while(cin >> c)
{
     cout << c << endl;
}
 
 
 

4) Can you think of a way to convert a lowercase character to uppercase and an uppercase character to lowercase?