char choice = 'x';
int days = 0;
int hours = 0;
int minutes = 0;
int seconds = 0;
int tseconds = 0;
//clrscr();
printf("You will asked to enter letter D for days, H for hours, M for minutes and S for seconds:");
printf("\nPress Please enter 'D' for days:");
scanf("%s",&choice);
if (choice == 'D')
{
printf("Enter how many days:");
scanf("%i", &days);
if (days >= 0)
{
1. Write down pseudo code for a switch statement that selects one of four possible values For a variable named salary. The four possible values for salary are 30, 40, 50&60 for Value you must print low. Medium high top respectively
2. Write down the input & output value you would use in a simple desk check procedure to test that you program is working properly
/******************************
Program
* Author your name goes here.
* Date written The date goes here.
* System MS-DOS
* ------------------+
* Function
*
*
*/
int Low = 30;
int Medium = 40;
int High = 50;
int Top = 60;
int Temp = 0;
printf("Enter the Low integer: ");
scanf("%i",&Low);
printf("Enter the medium integer: ");
scanf("%i",&Medium);
printf("Enter the the high integer : ");
scanf("%i",&High);
printf("\nEnter the top integer: ");
scanf("%i",&Top);
if (Low > Medium)
{
Temp = Low;
Low = Medium;
Medium = Temp;
}
if (Medium > High)
{
Temp = Medium;
Medium = High;
High = Temp;
}
if (High > Top)
{
Temp = High;
High = Top;
Top = Temp;
}
printf("The nembers in ascending order");
printf("are %i%i%i%i%",Low,Medium,High,Top);
printf("n\press Enter to contiue");
/*
*Top is NOW the toppest, just need to get Low, Medium and High
*in the right order
*/
getch();
return 0;
}
2. simple desk check table
step Input variable operation Output variable
1 30 30 = low low
2 40 40 = medium medium
3 50 50 = high High
4 60 60 = Top top
5
6
can any one help with the above 1 & 2 please
tahnks
// this is the program for printing the above table using while loop
#include<iostream.h>
#include<conio.h>
void main()
{
int quantity=10,price;
cout<<"\n quantity \t price;
while(quantity<=50)
{
price=quantity*5;
cout<<"\n %d \t %d",quantity,price;
quantity=quantity+10;
}
getch();
}
I think a simpler way would be to use setw(), which creates a table like what he wants to do. I forgot exactly how to use it, but I know that it is specifically helpful for use with turning a for loop into an organized table.