954,505 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Need help writing an algorithm for this program

{
int age;
cout <<"Enter Age"
<< end1;
cin >> age;
cout <<"The age you entered is" << age
return 0
}

Crisis757
Newbie Poster
1 post since Sep 2006
Reputation Points: 14
Solved Threads: 0
 

An algorithm is a sequence of steps that describe what a program should do. It is normally written before the program. So, if you can describe step by step what this program does, that is the algorithm. It is not rocket science. Just tell us what you think this program does, in point form. Since this is a small program, you may have to be explicit.

For example.

Step 1 - Declare an integer variable int
Step 2 - Display "Enter age"
Step 3 -  ....
WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 

Here is the definition of algorithm...

http://en.wikipedia.org/wiki/Algorithm

FC Jamison
Posting Pro in Training
Team Colleague
446 posts since Jun 2004
Reputation Points: 92
Solved Threads: 21
 

hey all I am beginner in IT and want to over that , Please i have a problem with algorithm, can you give me tips on how to go about it. here is th problem am trying to solve:

Write the following program and run it.

#include
#include
#include

int GCD_Euclid(int x, int y);
int GCD_EuclidRec(int x, int y);
int GCD_Simple(int x, int y);
bool isPrime(int x);
bool isprime_Rec(int x,int z);
using namespace std;
void main(int argc)
{
int x,y;

for(int rep=1; rep<=5; rep++){
srand(time(NULL)*rep);
x= rand()%100;
y= rand()%100;

cout << "GCD of " << x << " and " << y << " is " << GCD_Euclid(x,y) << endl;
cout << "GCD of " << x << " and " << y << " is " << GCD_EuclidRec(x,y) << endl;
cout << "GCD of " << x << " and " << y << " is " << GCD_Simple(x,y) << endl;
cout<

dodo rawash
Newbie Poster
1 post since Oct 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You