Friday

Flowchart Drawing and Programming using Raptor software

Raptor acronym stands for Rapid Algorithmic Prototyping Tool for Ordered Reasoning. This program is useful to draw flowcharts. Design computer program using flowchart without fixing to any specific programming language helps students to develop problem solving skills and improve algorithmic thinking.

Example of problem:
Draw a flowchart to accept a number and display all the numbers from 0 to the number entered.

One of the possible Flowchart Design Solutions:


Lectures or Labs Pedagogy:
+ Input symbol: Put double quote around the input prompt. For example, "Enter number: ".
+ Output symbol: No newline for the output message, uncheck the "End current line" checkbox. Use the plus symbol to append between variable and string.
+ Slide play speed slider to the maximum and click play button at the Raptor toolbar to get final program result without waiting for the animation to finish running. If you would like to have step by step animation, click on the "Step to Next Shape" toolbar button.

To generate C++ code:
+ Click on Menu | Generate | C++
+ The following code will be generated by Raptor:

#include <iostream>
#include <string>

using namespace std;
int main()
{
   string raptor_prompt_variable_zzyz;
   ?? count;
   ?? n;

   n =0;
   raptor_prompt_variable_zzyz ="Enter number: ";
   cout << raptor_prompt_variable_zzyz << endl;
   cin >> n;
   count =0;
   while (!(count>n))
   {
      cout << count+" ";      count =count+1;
   }

   return 0;
}


+ Modify the above source code to following to make the flowchart executable as C++ program:

#include <iostream>
#include <string>

using namespace std;

int main()
{
   string raptor_prompt_variable_zzyz;
   int count;
   int n;

      
//add spaces as needed to improve code readability  
   n = 0;

   raptor_prompt_variable_zzyz = "Enter number: "; 

   cout << raptor_prompt_variable_zzyz; 
//remove endl here
   cin >> n;

   count = 0;
   while( !(count>n) )
   {
      cout << count << " ";
      count = count + 1;  //add newline for this statement
   }

   return 0;
}


Sample Run 1:
Enter number: 10
0 1 2 3 4 5 6 7 8 9 10

Hope with this tutorial, students will love to do programming even more.
Have Fun!

No comments:

Newton-Raphson Method in C++

The Newton Raphson Method is an open method used to find the roots of a function. It employs the technique of linear approximation and invol...