3/01/2011

BCT1113 C.P. ASSIGNMENT 2

PART A

1. Fill in the blanks in each of the following statements:


 

  1. Typically, ______
    statements are used for counter-controlled repetition and _____
    statements are used for sentinel-controlled repetition.


 

  1. The ________repetition statement tests the loop-continuation condition at the end of the loop.


 


 

  1. The ______
    statement can be used only for testing constant integral expressions.


 


 

  1. When used as a condition, any nonzero value implicitly converts to _____; 0 (zero) implicitly converts to ________.


 


 

  1. In addition to selection and repetition statements, the ________
    and _________statements are used with control statements to alter the flow of control.


 

 

for

while

do…while

switch

true

break

continue

false

 


 

2. Fill in the third column in the following tables:

expression1

expression2

expression1 || expression2

false

false

 

false

true

 

true

false

 

true

true

 


 

expression1

expression2

expression1 && expression2

false

false

 

false

true

 

true

false

 

true

true

 


 


 


 

PART B

1. Write a program to output even numbers 1 to 20 using three types of loop statement (while, do-while and for).


 

  1. C++ program using 'while'
  2. C++ program using 'do-while'
  3. C++ program using 'for'


 


 

2. Write a program that input a grade. If the grade is less than 0 or greater than 100, your program should print the appropriate message informing the user that an invalid grade has been entered. Start with a pseudocode and flowchart.


 


 

  1. PSEUDOCODE


 

  1. FLOWCHART


 

2.3    C++ PROGRAM


 

  1. Write a program that input ten (15) integers. Print out the sum of those integers.


     

    1. PSEUDOCODE


 

  1. FLOWCHART


 

3.3    C++ PROGRAM


 


 

Due date : / 03 /2011

No comments:

Cara download Installer windows 10 dalam format ISO

1. Jika anda bercadang untuk download windows 10 melalui website rasmi windows - pilihan untuk download dalam format ISO tidak di berikan.  ...