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!
Reading. Practice. Writing.
Please feel free to comment. Suggestions are also welcomed here. Write something "wholesome serving purpose" here.
Subscribe to:
Post Comments (Atom)
Measure execution time with Julia, example using sorting algorithms
# random integers between 1 and 100 inclusive, generate thousands of them x = rand ( 1 : 100 , 100000 ) @time sort (x; alg=InsertionSort, r...
-
Open LibreOffice Draw program. Select the rectangle shape from shape toolbar at the bottom of drawing page. Click a point and drag-and-re...
-
DiGi Super Long Life is a feature where you can extend your talktime validity to 1 year for just RM38. Indirectly, the subscription fee is ...
-
DiGi Super Long Life is a feature where you can extend your talktime validity to 1 year for just RM30. Indirectly, the subscription fee is...
No comments:
Post a Comment