/**************************************Topic 1, Example 1*******************************/
//Topic 1, Example 1
//Program prompts user to enter total number of inches
//Program converts user-entered number of inches to
// yards/feet/inches
//Program will output the resulting converted values
#include
const int YARD = 36;
const int FEET = 12;
int main( )
{
int totalInches = 0; //stores user-entered value
int yards = 0; //stores converted inches to yards
int feet = 0; //stores converted inches to feet
int inches = 0; //stores converted remaining inches
cout > totalInches; //stores user-entered value
yards = totalInches / YARD; //calculate number of yards
feet = (totalInches % YARD) / FEET; //calculate number of feet
inches = (totalInches % YARD) % FEET; //calculate number of inches
cout
int main( )
{
double hoursWorked = 0; //stores total hours worked
double payPerHour = 0; //stores hourly pay rate
double salary = 0; //stores calculated salary
cout > hoursWorked; //store user input
cout > payPerHour; //store user input
salary = hoursWorked * payPerHour; //calculate salary
cout
#include //header for formatting output
int main( )
{
double hoursWorked = 0; //stores total hours worked
double payPerHour = 0; //stores hourly pay rate
double salary = 0; //stores calculated salary
cout > hoursWorked; //store user input
cout > payPerHour; //store user input
salary = hoursWorked * payPerHour; //calculate salary
cout << "\nThe salary for " //program output
<< hoursWorked << " hour(s) worked at a rate of $"
<< payPerHour << " per hour is $" << salary << ".";
cout << endl << endl;
return(0);
}