KRHS Internet Lesson

Teacher Name:Mr. Rung                          Date of Lesson: January

Course Name: C++                    Lesson Name: Chap 9.3b

Student Name

Password


Objective
To complete the workbook questions.


Primary Focus

Answer questions 1 and 2 below.
 
 Use the program below to answer # 3, 4 and 5. 
 
 #include  
 #include  
 
 int main () 
 { 
 char c; 
 
 cout « "Please enter a character \n"; cin » c; 
 
 
 if (islower (c))
   c = toupper(c);
 if (isdigit(c)) 
   cout « "The character entered is a number \n"; 
 
 if (isalpha(c)) 
   cout « "The character entered is a letter \n"; 
 if (isupper (c))
   c = tolower(c); 
 
 cout « c; 
 
 return 0; 
 }//MAIN 
 
 
 

Site Links
Course Home Page

Additional Resources

Site Links


Question #1

Write a function call that converts a character to uppercase.


Question #2

Write a function call that calculates the exponential function e to the x power and returns the result to the variable Exponential.


Question #3

If the character 8 is entered, what will be the output to the screen?


Question #4

If the character t is entered, what will be the output to the screen?


Question #5

If the character T is entered, what will be the output to the screen?



Question #6

 In the space below the following program,
 write the output that will be written to the screen. 
 
 #include < iostream.h > 
 
 //PROTOTYPES 
 int Change-Values(int, int &); 
 
 //GLOBAL VARIABLES 
 char M-Initial = 'H';   //GLOBAL VARIABLE 
 
 int main() 
 { 
 int i=O, j=5, returned=O; 
 
 j++; 
 i++; 
 
 cout « "i = "«i«endl; 
 cout « "j = "«j«endl; 
 cout « "M-Initial = "«M-Initial«endl; 
 
 
 returned = Change-Values(i,j); 
 
 cout « "i = "«i«endl; 
 cout « "j = "«j«endl;
 cout « "M-Initial = "«M-Initial«endl; 
 cout « "Returned value = "«returned«endl; 
 
 return 0; 
 }//MAIN 
 
 int Change-Values(int Value, int & Reference) 
 { 
 Reference = Reference + Value; 
 Value = Reference + Value; 
 M-Initial++; 
 return (Value * Reference); 
 }//CHANGE-VALUE