This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*Write a program that asks the user to enter an item's wholesale cost and its markup percentage. | |
| It should then display the item's retail price. | |
| The program should have a function named calculateRetail that receives the wholesale cost and the markup percentage as arguments, | |
| and returns the retail price of the item. | |
| Input Validation: Do not accept negative values for either the wholesale cost of the item or the markup percentage. | |
| */ | |
| #include <iostream> | |
| #include <conio.h> | |
| #include <ctime> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Read data from external file and sort it alphabitically */ | |
| #include <iostream> | |
| #include <conio.h> | |
| #include <ctime> | |
| #include <iomanip> | |
| #include <cstdlib> | |
| #include <fstream> | |
| #include <string> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*Write a program that uses a loop to display patterns below: | |
| + | |
| ++ | |
| +++ | |
| ++++ | |
| +++++ | |
| ++++++ | |
| +++++++ | |
| ++++++++ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Write a program that asks the user for a positive integer no greater than 15. | |
| The program should then display a square on the screen using the character 'X'. | |
| The number entered by the user will be the length of each side of the square. So if user enters 5, we will display | |
| XXXXX | |
| XXXXX | |
| XXXXX | |
| XXXXX | |
| XXXXX | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*Write a program that generates a random number and asks the user to guess what the number is. | |
| If the user's guess is higher than the random number, the program should display "Too high, try again". | |
| If it is lower, it should display "Too low, try again". | |
| The program should use a loop that repeats until the user correctly guesses the random number. | |
| */ | |
| #include <iostream> | |
| #include <conio.h> | |
| #include <ctime> | |
| #include <iomanip> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Write a program that asks the user to enter today's sales for five stores. the program should display a bar graph comparing each store | |
| sales. Create each bar bar in the bar grap by displaying a row of asteriks. each asterisk should represnt a $100*/ | |
| #include <iostream> | |
| #include <conio.h> | |
| #include <ctime> | |
| #include <iomanip> | |
| using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*Write a program with a loop that lets the user enter a series of integers. The user should enter -99 to signal the end of the series. | |
| After all the numbers have been entered, the program should display the largest and the smallest numbers entered. | |
| */ | |
| #include <iostream> | |
| #include <conio.h> | |
| #include <ctime> | |
| #include <iomanip> | |
| using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*Write a program that will predict the size of a population of organisms. | |
| The program should ask the user for the starting number of organisms, their average daily population increase (as a percentage), | |
| and the number of days they will multiply. A loop should display the size of the population for each day. | |
| Input Validation: Do not accept a number less than 2 for the starting size of the population. | |
| Do not accept a negative number for average daily population increase. | |
| Do not accept a number less than 1 for the number of days they will multiply. | |
| */ | |
| #include <iostream> | |
| #include <conio.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. | |
| The program should first ask for the number of years. The outer loop will iterate once for each year. | |
| The inner loop will iterate twelve times, once for each month. Each iteration of the inner loop will ask the user for the inches of | |
| rainfall for that month. After all the iterations, the program should display the number of months, the total inches of rainfall | |
| and the average rainfall per month for the entire period.Input validation: Do not accept a number less than 1 for the number of years. | |
| Do not accept negative numbers for the monthly rainfall.*/ | |
| #include <iostream> | |
| #include <conio.h> | |
| #include <ctime> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Write a program that calculates the occupancy rate for a hotel. The program should start by asking user how many floors the hotel has. | |
| A loop should then iterate once for each floor. In each iteration, the loop should ask the user for the number of rooms on the floor | |
| and how many of them are occupied. After all the iterations, the program should display how many rooms the hotel has, | |
| how many of them are occupied, how many are unoccupied, and the percentage of rooms that are occupied. | |
| The percentage may be calculated by dividing the number of rooms occupied by the number of rooms. | |
| Input validation: Do not accept a value less than 1 for the number of floors. | |
| Do not accept a number less than 10 for the number of rooms on a floor. | |
| NOTE: It is traditional that most hotels do not have 13th floor. The loop in this program should skip the entire 13th iteration. */ | |
| #include <iostream> |