| Demo Program 
        with Pseudocode In the past, 
      programmers would develop flowcharts to outlinethe structure of a program.  Today, more programmers
 utilize the process of pseudocoding.  Pseudocode is an outline
 of how a program will be developed written in both English
 and C++ syntax.  During the pseudocode process, decisions are made as 
		to the variable names that will be used and any formulas that
 the program may require.
 
        
        
          
            | Sample program using pseudocode: (TASK:  Write a program that 
			will ask a student to enter his/her first name, 2 report card grades 
			for CS1, and final examination score.  The program will then 
			print out the student's course grade based upon the fact that the 2 
			quarter grades will count twice and the final examination will count 
			once).
 
 
              
              
                
                  | Pseudocode: 1.  Ask for name (apstring name)
 2.  Ask for quarter grades (int G1, G2)
 3.  Ask for final exam (int final)
 4.  Compute the course grade
 (double grade = (2*G1 + 2*G2 + 
                  final)/5)
 5.  Print information to screen
 | #include 
                  <iostream.h>#include "apstring.cpp"
 int main(void)
 {
 apstring name;
 int G1, G2, final;
 double grade;
 
 cout<<"Enter first name";
 cin>>name;
 cout<<"Enter first quarter grade";
 cin>>G1;
 cout<< "Enter second quarter grade";
 cin>>G2;
 cout<<"Enter final exam";
 cin>>final;
 
 grade = (2*G1 + 2*G2 + final)/5;
 cout<<name
 <<", your course grade is "
 << grade
 <<"." <<endl <<endl;
      
                  return 0;}
 |  
                  |  |  |    
       
  
  Return to Topic Menu  |
  Computer Science Main Page |
  MathBits.com |
  Terms of Use   |