Return to Topic Menu | Computer Science Main Page | | Terms of Use

Demo Program with Pseudocode

In the past, programmers would develop flowcharts to outline
the 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).

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";
     cout<<"Enter first quarter grade";
     cout<< "Enter second quarter grade";
     cout<<"Enter final exam";

     grade = (2*G1 + 2*G2 + final)/5;
             <<", your course grade is "
             << grade
             <<"." <<endl <<endl;

     return 0;



Return to Topic Menu | Computer Science Main Page | | Terms of Use