I am just starting a programming class in C++ and my teacher hasn't taught anything about writing pseduocode and programs, yet expects us to be able to do so. I need help!!!!

1. Write out a complete algorithm in pseudocode for the following: User enters two uppercase letters or two lowercase letters. Design an algorithm that determines which letter lies halfway between any two letters of the alphabet and displays that letter.
~I thought that you would have to asign each letter of the alphabet a number, A=1, B=2... and use have the computer convert the letters into numbers, preform division, and convert back to a letter, but I don't know if that is even close to correct or not.

2. All years that are evenly divisible by 400 are always a leap year. A year is also a leap year if it is evenly divisible by 4 but not evenly divisible by 100. For example, 1600 was a leap year because it is evenly divisible by 400. 1988 was a leap year because it was evenly divisible by 4 AND not evenly divisible by 100. Design an algorithm that will determine if a year entered by the user is a leap year. The output should restate the input year and describe it as a leap year or not a leap year.
~I think I have to have a formula that is YearInput/400, if yes, state "Year is a leapyear". If it is not, have it calculate YearInput/4 evenly but not YearInput/100 not evenly, if yes state "Year is a leapyear." If not, state year and "Not leapyear." I don't know if this is anywhere close to correct.

3. Write out a complete algorithm for the following problem, and then use C++ syntax to create your first program. "The user should be requested to enter a number of seconds. The program should read int he user's number and conver the number of seconds entered by the user to the equivalent number of hours, minutes, and seconds and output this result."
~I really don't have very many ideas for this one. I think I will have to use a formula that will divide the number of seconds into hours, seconds into minutes, and the remainder will be seconds. I just don't know how to do it.

IF ANYONE CAN GIVE ME EVEN A LITTLE HELP THAT WOULD BE GREAT!!!!

An algorithm is a method of doing something. You can write an algorithm on just about anything - an algorithm on how to do long division, how to find the factorial of a number ... even an algorithm on how to walk up a flight of stairs!

The following two links should prove helpful:

http://www.daniweb.com/tutorials/1727.html
http://www.daniweb.com/tutorials/1731.html

Now, let's talk about pseudocode. Pseudocode is half code half english. In other words, it is the way you would code something without actually following strict code syntax, but rather in a way that makes sense to you.

Pseudocode is different for everyone because we each think in different ways. Take the following example of a program which prompts the user for two values, and then prints their sum.

Pseudocode

prompt user for value
value1 = input from keyboard
prompt user for value
value2 = input from keyboard
sum = value1 + value2
print sum to screen

Program in C++

int value1, value2, sum;
cout << "Enter value: ";
cin >> value1;
cout << "Enter value: ";
cin >> value2;
sum = value1 + value2;
cout << "The sum is " << sum;

For those starting out in programming, pseudocode or flowcharting is used to help get them started on coding. Often, when new programmers take a look at a coding assignment, it looks daunting, and it's hard to figure out exactly where to start. Especially with all of that specific code syntax. Pseudocode lets you focus on the algorithm - the problem solving technique - without letting the actual code syntax get in the way. Once you have the technique you're going to use, it's much easier to convert to code line by line, just like I did in the example above.

I am having an issue generating a pseudocode for driving a car.
Can you please help me understand this. I understand I need to start with unlock door, open door, get in car, close door, put on seatbelt, put key in ignition, turn on ignition, put car in drive, press on accelerator. I just do not understand how to write that in pseudocode.

Thank you!!!

I am having an issue generating a pseudocode for driving a car.
Can you please help me understand this. I understand I need to start with unlock door, open door, get in car, close door, put on seatbelt, put key in ignition, turn on ignition, put car in drive, press on accelerator. I just do not understand how to write that in pseudocode.

Hi everyone,
I am petty much in the same predicament as the first person who posted. I have an instructor who basically does not explain how to write pseudocode or how to write programs. I have to write an algorithm where users enter a number input where a program performs a computation. The user can choose to square, cube, double, or halve the number. The result should output to the screen and after the result is displayed, the program should prompt the user to enter another number and select another computation or exit the program. I am completely lost and need help. Can someone help me please !!!!

#include<iostream>
#include<fstream>
#include<string>
#include<iomanip>
using namespace std;

struct MenuItemType
{
 int ItemNo;
 string MenuItem;
 double Price;
};
struct Oder//plz chang this names
{
    int Select;//plz chang this names
    int NOS;//plz chang this names
};

void main()
{
 MenuItemType Item[10];
 Oder Type[10];
void GetData(MenuItemType Item[10],ifstream& Menu);
void ShowMenu(MenuItemType Item[10],Oder Type[10]);




 ifstream Menu;
 Menu.open("data.txt");//plz chang this names

GetData(Item,Menu);
ShowMenu(Item,Type);

Menu.close();
}

void GetData(MenuItemType Item[10],ifstream& Menu)
{

    for(int a=0;a<10;a++)
    {
        Menu>>Item[a].ItemNo;
        Menu>>Item[a].MenuItem;
        Menu>>Item[a].Price;
    }
}
void ShowMenu(MenuItemType Item[10],Oder Type[10])
{
void PrintCheck(MenuItemType Item[10],Oder Type[10]);
    bool found=true;
    char g;
    int x=0;


    cout<<"==================================="<<endl;
    cout<<"  ***Welcome to Puff And Fresh***"<<endl;
    cout<<"   **Breakfast Billing System**"<<endl;
    cout<<"==================================="<<endl<<endl;
    cout<<"Item No\t\t"<<"Menu Item\t"<<"Price"<<endl<<endl;
    for(int a=0;a<10;a++)
    {
        cout<<setw(10)<<left<<Item[a].ItemNo;
        cout<<setw(25)<<Item[a].MenuItem;
        cout<<"Rs."<<setw(7)<<Item[a].Price<<endl;
    }

    while(found && x<10 )
    {    
        cout<<endl<<"Enter Iterm No:\t";
        cin>>Type[x].Select;
        cout<<endl;
if((Type[x].Select>=111)&&(Type[x].Select<=120))
{
        cout<<"Enter how many packets you want of that item:\t";
        cin>>Type[x].NOS;
        cout<<endl;
        cout<<"Enter 'f' for a nother item or Press any other key for bill:\t";
        cin>>g;
        if(g!='f')
        {found=false;}

        x++;
}
else
cout<<"we dont have that type item";

    }
    //system("cls";)
PrintCheck(Item,Type);
}
void PrintCheck(MenuItemType Item[10],Oder Type[10])
{
    double t=0;
    int x=0;

    cout<<"==================================="<<endl;
    cout<<"  ***Welcome to Puff And Fresh***"<<endl;
    cout<<"   **Breakfast Billing System**"<<endl;
    cout<<"==================================="<<endl<<endl;
    cout<<"Amount\t"<<"Menu Item\t"<<"Price"<<endl<<endl;

    while(x<10)
    {


      switch(Type[x].Select)
        {

        case 111:t=t+(Item[0].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[0].MenuItem<<"Rs."<<setw(8)<<Item[0].Price*Type[x].NOS<<endl;
            break;
        case 112:t=t+(Item[1].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[1].MenuItem<<"Rs."<<setw(8)<<Item[1].Price*Type[x].NOS<<endl;
            break;
        case 113:t=t+(Item[2].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[2].MenuItem<<"Rs."<<setw(8)<<Item[2].Price*Type[x].NOS<<endl;
            break;
        case 114:t=t+(Item[3].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[3].MenuItem<<"Rs."<<setw(8)<<Item[3].Price*Type[x].NOS<<endl;
            break;
        case 115:t=t+(Item[4].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[4].MenuItem<<"Rs."<<setw(8)<<Item[4].Price*Type[x].NOS<<endl;
            break;
        case 116:t=t+(Item[5].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[5].MenuItem<<"Rs."<<setw(8)<<Item[5].Price*Type[x].NOS<<endl;
            break;
        case 117:t=t+(Item[6].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[6].MenuItem<<"Rs."<<setw(8)<<Item[6].Price*Type[x].NOS<<endl;
            break;
        case 118:t=t+(Item[7].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[7].MenuItem<<"Rs."<<setw(8)<<Item[7].Price*Type[x].NOS<<endl;
            break;
        case 119:t=t+(Item[8].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[8].MenuItem<<"Rs."<<setw(8)<<Item[8].Price*Type[x].NOS<<endl;
            break;
        case 120:t=t+(Item[9].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[9].MenuItem<<"Rs."<<setw(8)<<Item[9].Price*Type[x].NOS<<endl;
            break;
        }

x++;
    }

    cout<<setw(29)<<left<<"Tax"<<"Rs."<<setw(8)<<(t/100)*5<<endl;
    cout<<setw(29)<<left<<"Amount Due"<<"Rs."<<setw(8)<<t+((t/100)*5)<<endl;



}
#include<iostream>
#include<fstream>
#include<string>
#include<iomanip>
using namespace std;

struct MenuItemType
{
 int ItemNo;
 string MenuItem;
 double Price;
};
struct Oder
{
	int Select;
	int NOS;
};

void main()
{
 MenuItemType Item[10];
 Oder Type[10];
void GetData(MenuItemType Item[10],ifstream& Menu);
void ShowMenu(MenuItemType Item[10],Oder Type[10]);




 ifstream Menu;
 Menu.open("data.txt");

GetData(Item,Menu);
ShowMenu(Item,Type);

Menu.close();
}

void GetData(MenuItemType Item[10],ifstream& Menu)
{

	for(int a=0;a<10;a++)
	{
		Menu>>Item[a].ItemNo;
	    Menu>>Item[a].MenuItem;
        Menu>>Item[a].Price;
	}
}
void ShowMenu(MenuItemType Item[10],Oder Type[10])
{
void PrintCheck(MenuItemType Item[10],Oder Type[10]);
    bool found=true;
	char g;
    int x=0;
	

	cout<<"==================================="<<endl;
	cout<<"  ***Welcome to Puff And Fresh***"<<endl;
	cout<<"   **Breakfast Billing System**"<<endl;
    cout<<"==================================="<<endl<<endl;
	cout<<"Item No\t\t"<<"Menu Item\t"<<"Price"<<endl<<endl;
    for(int a=0;a<10;a++)
	{
		cout<<setw(10)<<left<<Item[a].ItemNo;
	    cout<<setw(25)<<Item[a].MenuItem;
        cout<<"Rs."<<setw(7)<<Item[a].Price<<endl;
	}

	while(found && x<10 )
	{	 
		cout<<endl<<"Enter Iterm No:\t";
		cin>>Type[x].Select;
        cout<<endl;
if((Type[x].Select>=111)&&(Type[x].Select<=120))
{
		cout<<"Enter how many packets you want of that item:\t";
		cin>>Type[x].NOS;
        cout<<endl;
		cout<<"Enter 'f' for a nother item or Press any other key for bill:\t";
		cin>>g;
		if(g!='f')
		{found=false;}

		x++;
}
else
cout<<"we dont have that type item";
	
	}
	//system("cls";)
PrintCheck(Item,Type);
}
void PrintCheck(MenuItemType Item[10],Oder Type[10])
{
	double t=0;
	int x=0;

	cout<<"==================================="<<endl;
	cout<<"  ***Welcome to Puff And Fresh***"<<endl;
	cout<<"   **Breakfast Billing System**"<<endl;
    cout<<"==================================="<<endl<<endl;
	cout<<"Amount\t"<<"Menu Item\t"<<"Price"<<endl<<endl;

	while(x<10)
	{
		
		
      switch(Type[x].Select)
		{

		case 111:t=t+(Item[0].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[0].MenuItem<<"Rs."<<setw(8)<<Item[0].Price*Type[x].NOS<<endl;
			break;
		case 112:t=t+(Item[1].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[1].MenuItem<<"Rs."<<setw(8)<<Item[1].Price*Type[x].NOS<<endl;
            break;
        case 113:t=t+(Item[2].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[2].MenuItem<<"Rs."<<setw(8)<<Item[2].Price*Type[x].NOS<<endl;
            break;
        case 114:t=t+(Item[3].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[3].MenuItem<<"Rs."<<setw(8)<<Item[3].Price*Type[x].NOS<<endl;
			break;
        case 115:t=t+(Item[4].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[4].MenuItem<<"Rs."<<setw(8)<<Item[4].Price*Type[x].NOS<<endl;
			break;
        case 116:t=t+(Item[5].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[5].MenuItem<<"Rs."<<setw(8)<<Item[5].Price*Type[x].NOS<<endl;
			break;
        case 117:t=t+(Item[6].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[6].MenuItem<<"Rs."<<setw(8)<<Item[6].Price*Type[x].NOS<<endl;
			break;
        case 118:t=t+(Item[7].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[7].MenuItem<<"Rs."<<setw(8)<<Item[7].Price*Type[x].NOS<<endl;
			break;
        case 119:t=t+(Item[8].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[8].MenuItem<<"Rs."<<setw(8)<<Item[8].Price*Type[x].NOS<<endl;
			break;
        case 120:t=t+(Item[9].Price*Type[x].NOS);cout<<" "<<setw(8)<<left<<Type[x].NOS<<setw(20)<<Item[9].MenuItem<<"Rs."<<setw(8)<<Item[9].Price*Type[x].NOS<<endl;
			break;
		}

x++;
	}
	
	cout<<setw(29)<<left<<"Tax"<<"Rs."<<setw(8)<<(t/100)*5<<endl;
	cout<<setw(29)<<left<<"Amount Due"<<"Rs."<<setw(8)<<t+((t/100)*5)<<endl;



}
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

#define PI 3.14159

double circleCircumference(double a);
double circleArea(double b);
double cylinderVolume(double c,double d);
double sphereArea(double e);
double sphereVolume(double f);
double rectangleArea(double g,double h);
double boxVolume(double i,double j,double k);
double trapeziumArea(double l,double m,double n);
double pyramidVolume(double o,double p,double q);
double coneVolume(double r,double s);




int main(void)
{

    double radius;
    int choice;
    double lilitan,luasbulatan,isipadusilinder,high,luasspera,isipaduspera,luassegiempat,width,length,isipadukotak,luastrapezium,firstparallel,secondparallel,isipadupiramid,isipadukon;

    printf("Enter a choice:\n");
    printf("1   Calculate circle circumference\n2   Calculate circle area\n");
    printf("3   Calculate cylinder volume\n4   Calculate sphere area\n");
    printf("5   Calculate sphere volume\n6   Calculate rectangle area\n");
    printf("7   Calculate box volume\n8   Calculate trapezium area\n");
    printf("9   Calculate pyramid volume\n10  Calculate cone volume\n");
    printf("11  End program\n");
	scanf("%d",&choice);

    while(choice!=11)
    {
            switch(choice)
            {
            case 1:

                printf("Enter the radius: ");
                scanf("%lf",&radius);
                lilitan=circleCircumference(radius);
                printf("Circumference = %lf",lilitan);
                break;

            case 2:
                printf("Enter the radius: ");
                scanf("%lf",&radius);
                luasbulatan=circleArea(radius);
                printf("Areacircle = %lf\n",luasbulatan);
                break;

            case 3:
                printf("Enter the radius and high: ");
                scanf("%lf%lf",&radius,&high);
                isipadusilinder=cylinderVolume(radius,high);
                printf("Volumecylinder = %lf\n",isipadusilinder);
                break;

            case 4:
                 printf("Enter the radius: ");
                 scanf("%lf",&radius);
                 luasspera=sphereArea(radius);
                 printf("Areasphere = %lf\n",luasspera);
                 break;
                
            case 5:
                printf("Enter the radius: ");
                scanf("%lf",&radius);
                isipaduspera=sphereVolume(radius);
                printf("Volumesphere = %lf\n",isipaduspera);
                break;
                
            case 6:
                printf("Enter the width and length: ");
                scanf("%lf%lf",&width,&length);
                luassegiempat=rectangleArea(width,length);
                printf("Arearectangle = %lf\n",luassegiempat);
                break;
                
            case 7:
                printf("Enter the width length and high: ");
                scanf("%lf%lf%lf",&width,&length,&high);
                isipadukotak=boxVolume(width,length,high);
                printf("Volumebox = %lf\n",isipadukotak);
                break;
                
            case 8:
                printf("Enter the first parallel second parallel and high: ");
                scanf("%lf%lf%lf",&firstparallel,&secondparallel,&high);
                luastrapezium=trapeziumArea(firstparallel,secondparallel,high);
                printf("Areatrapezium = %lf\n",luastrapezium);
                break;
                
             case 9:
                printf("Enter the width length and high: ");
                scanf("%lf%lf%lf",&width,&length,&high);
                isipadupiramid=pyramidVolume(width,length,high);
                printf("Volumepyramid = %lf\n",isipadupiramid);
                break;                                                                             

            case 10:
                printf("Enter the radius and high: ");
                scanf("%lf%lf",&radius,&high);
                isipadukon=coneVolume(radius,high);
                printf("Volumecone = %lf\n",isipadukon);
                break;
            }//end switch

        printf("\n\Enter a choice:\n");
        printf("1   Calculate circle circumference\n2   Calculate circle area\n");
        printf("3   Calculate cylinder volume\n4   Calculate sphere area\n");
        printf("5   Calculate sphere volume\n6   Calculate rectangle area\n");
        printf("7   Calculate box volume\n8   Calculate trapezium area\n");
        printf("9   Calculate pyramid volume\n10  Calculate cone volume\n");
        printf("11  End program\n");
        scanf("%d",&choice);

    }



    printf("\n\nThank you for using this application.\n");
    return 0;

}

double coneVolume(double r,double s);

double circleCircumference(double a)
{
    double circmf;
    circmf=2*PI*a;
    return circmf;
}


double circleArea(double b)
{
    double area;
    area=PI*b*b;
    return area;
}


double cylinderVolume(double c,double d)
{
    double volume;
    volume=PI*c*c*d;
    return volume;
}


double sphereArea(double e)
{
    double area;
    area=4*PI*e*e;
    return area;
}


double sphereVolume(double f)
{
    double volume;
    volume=4*PI*f*f*f/3;
    return volume;
}

double rectangleArea(double g,double h)
{
    double area;
    area=g*h;
    return area;
}


double boxVolume(double i,double j,double k)
{
    double volume;
    volume=i*j*k;
    return volume;
}


double trapeziumArea(double l,double m,double n)
{
    double area;
    area=(l+m)*n/2;
    return area;
}


double pyramidVolume(double o,double p,double q)
{
    double volume;
    volume=o*p*q/3;
    return volume;
}


double coneVolume(double r,double s)
{
    double volume;
    volume=PI*r*r*s/3;
    return volume;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.