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!

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;

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

void main()
{
Oder Type;

}

{

for(int a=0;a<10;a++)
{
}
}
{
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;
for(int a=0;a<10;a++)
{
cout<<setw(10)<<left<<Item[a].ItemNo;
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);
}
{
double t=0;
int x=0;

cout<<"==================================="<<endl;
cout<<"  ***Welcome to Puff And Fresh***"<<endl;
cout<<"   **Breakfast Billing System**"<<endl;
cout<<"==================================="<<endl<<endl;

while(x<10)
{

switch(Type[x].Select)
{

break;
break;
break;
break;
break;
break;
break;
break;
break;
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;

{
int ItemNo;
double Price;
};
struct Oder
{
int Select;
int NOS;
};

void main()
{
Oder Type;

}

{

for(int a=0;a<10;a++)
{
}
}
{
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;
for(int a=0;a<10;a++)
{
cout<<setw(10)<<left<<Item[a].ItemNo;
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);
}
{
double t=0;
int x=0;

cout<<"==================================="<<endl;
cout<<"  ***Welcome to Puff And Fresh***"<<endl;
cout<<"   **Breakfast Billing System**"<<endl;
cout<<"==================================="<<endl<<endl;

while(x<10)
{

switch(Type[x].Select)
{

break;
break;
break;
break;
break;
break;
break;
break;
break;
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)
{

int choice;

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("Circumference = %lf",lilitan);
break;

case 2:
printf("Areacircle = %lf\n",luasbulatan);
break;

case 3:
printf("Enter the radius and high: ");
break;

case 4:
printf("Areasphere = %lf\n",luasspera);
break;

case 5:
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);
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);
break;

case 10:
printf("Enter the radius and high: ");
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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.