Writing an Algorithm

rosalie1946's Avatar
Newbie Member
I am helping my handicapped son who is taking a computer programming course at ITT-Technical and this one is really Greek to me.
It is
Rewrite the following If-Then-Else If statement as a Select Case Statement.
If selection == 1 Then
Display "You selected A."
Else If selection == 2 Then
Display "You selected 2."
Else If selection == 3 Then
Display "You selected 3."
Else If selection == 4 Then
Display "You selected 4."
Display "Not good with numbers, eh?"
End If

I don't even know where to start? Can you help us. There are several others we'll need help with too!

also do you help with programming exercises???

rosalie1946's Avatar
Newbie Member
Can anyone help us with this?
cpulocksmith's Avatar, Join Date: Jul 2008
Skilled contributor
here i hope this helps
#include <iostream> //basic input output, allows you to get input and give output
#include <stdio.h>// in this code allows you to pause

using namespace std; // standed library

int main(){//main code block everything importand is in here
    int Number = 1;// the number you will input right now it equals 1
    cin>>Number;// asks you for the number
    switch (Number)//tells the switch what case it wants
case 1://outputs every thing in the case 1 is Number = 1
cout << "you selected 1" <<endl;
case 2://outputs every thing in the case 1 is Number = 2
cout << "you selected 2" <<endl;
case 3://outputs every thing in the case 1 is Number = 3
cout << "you selected 3" <<endl;
case 4://outputs every thing in the case 1 is Number = 4
cout << "you selected 4" <<endl;
if (Number > 4){//if the Number is greater then 4 it out puts this
     cout<<"not good with number, hu?"<<endl;
system("pause");//pauses the output so you can see it(this is not really needed)

shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Moved to programming forum