Write a program that prompts the user to input a string. The program then uses the function substr to remove all the vowels from the string. For example, if str = "There", then after removing all the vowels, str = "Thr". After removing all the vowels, output the string. Your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel. |
The history teacher at your school needs help in grading a true/false test. The students' IDs and test answers are stored in a text file. The first entry in the file contains answers to the test in the form: TFFTFFTTTFFTFTFTFTT Every other entry in the file is the studentID, followed by a blank, followed by the student's responses. For example, the entry: ABC54301 TFTFTFTT TFTFTFFTTFT Indicated that the student ID is ABC 54301 and the answer to question 1 is true, the answer to question 2 is false, and so on. This student did not answer question 9. The exam has 20 questions, and the class has more than 150 students. Each correct answer is awarded two points, each wrong answer gets one point deducted and no answer gets zero points. Write a program that processes the test data. The output should be the student's ID, followed by the answers, followed by the test score, followed by the test grade. Assume the standard grade scale (90-100 -- a) (80-89 -- b) etc..etc.. |
Write a program to help a local restaurant automate its breakfast billing system. The program should do the following: a. Show the customer the different breakfast items offered by the restaurant b. Allow the customer to select more than one item from the menu. c. Calculate the bill Assume the restaurant offers the following breakfast items: Plain Egg.............1.45 Bacon and Egg....2.45 Muffin..................0.99 French Toast.......1.99 Fruit Basket.........2.49 Cereal.................0.50 Tea......................0.75 Define a struct menuItemType with two components to hold the name and price of an item. Use an array, menuList, of the menuItemTypes. Your program must contain at least the following functions: [] Function GetData: This function loads data into the array [] Function ShowMenu: Displays items offered by restaurant and tells user how to select items. [] Function printCheck: calculates and prints check(Note that the billing amount should include a 5% tax) Format your output with 2 decimal places. The name of each item in the output must be left justified. You may assume that the user selects only one of a particular item. |
Write a program that converts a number entered in Roman numerals to decimal. Your program should consist of a class, say, romanType. An object of type romanType should do the following: a store the number as a Roman numeral b convert and store the number into decimal form c print the number as a roman numeral or decimal number as requested by the user The decimal values of the Roman numerals are: M 1000 D 500 C 100 L 50 X 10 V 5 I 1 d test your program using the following Roman numerals: MCXIV, CCCLIX, MDCLXVI |
Part 1: a point in the x-y plane is represented by its x-coordinate and y-coordinate. Design a class, pointType, that can store and process a point in the x-y plane. You should then perform operations on the point, such as setting the coordinates of the point, printing the coordinates and returns the x/y coordinate. Part 2: Every circle has a center and a radius. Given the radius, we can determine the circle's area and circumference. Given the center, we can determine its position in the x-y plane. The center of the circle is a point in the x-y plane. Design a class, circleType, that can store the radius and center of a circle. Because the center is in the x-y plane, you must derive the class circleType from pointType. You should be able to perform the usual operations on the circle, such as setting the radius, printing the radius, calculation and printing the area and circumference, and carrying out the usual operations on the center . Write a program to test various operations on a circle. |
Recall that in C++ there is no check on an array index out of bounds. However, during program execution, an array index out of bounds can cause serious problems. Also, in c++ the array index starts at zero. Design the class myArray that solves the array index out of bound problem, and also allows the user to begin the array index starting at any integer, positive or negative. Every object of type myArray is an array of type int. During execution, when accessing an array component, if the index is out of bounds, the program must terminate with an appropriate error message. Consider the following statements: myArray<int> list(5); myArray<int> myList(2, 13); myArray<int> yourList(-5,9); the statement in line 1 declares a list to be an array of 5 elements, the element type is int, and the elements start from list[0] .... list [4]. Line 2 declares a list of 11 elements, starting at myList[2] ... myList[12]. Line 3 declares a list of 14 elements, starting at myList[-5] ... myList[8]. Write a program to test your class. |
Write a function reverseDiagonal that reverses both the diagonals of a two-dimensional array. For example, here is a two dimensional array: 96 26 31 81 41 71 66 56 61 51 46 76 36 86 91 21 what it should look like after the function: 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96 |
Write a program that can be used to assign seats for a commercial airplane. The airplane has 13 rows, with six seats in each row. Rows 1 & 2 are first class, rows 3 through 7 are business class, and rows 8 through 13 are economy class. Your program must prompt the user to enter the following information: a Ticket type(first class, business, economy) bDesired seat |
Output the seating plan in the following form: http://pastebin.com/Xr8Z54Dd Here, * indicates that the seat is availible; X indicates that the seat is occupied. Make this a menu-driven program; show the user's choices and allow the user to make the appropriate choices. |
Write a program to help a local stock trading company automate its systems. The company invests only in the stock market. At the end of each trading day, the company would like to generate and post the listings of its stocks so that investors can see how their holdings performed that day. We assume that the company invests in, say 10 different stocks. The desired output is to produce two listings, one sorted by stock symbol and another sorted by percent gain from highest to lowest. The input data is provided in a file in the following format: symbol openingPrice closingPrice todayHigh todayLow prevClose volume MSMT 112.50 115.75 116.50 111.75 113.50 6723823 The first line indicates that the stock symbol is MSMT, today's opening price was 112.50, the closing was 115.75, today's high was 116.50 and so on. Text file needed for this program(data on stocks): http://dl.dropbox.com/u/78573135/StockData.txt The listings sorted by stock symbols must be in the following form: http://dl.dropbox.com/u/78573135/IMG_20120725_112718.jpg design and implement a stock object a (Stock Object) Design and implement the stock object. Class the class that captures the various characteristics of the object stockType. the main componenets of a stock are the stock symbol, price and number of shares. Moreover, we need to output the opening price closing price, high/low price, previous price and percent loss/gain for the day. These are also characteristics of a stock. The stock should store all of this information. Perform the following operations on each stock object: []Set stock information [] Print stock information []Show different prices []Calculate and price the percent gain/loss []Show number of shares **The natual order of the stock list is by the stock symbol. Overload the relational operators to compare two stock objects by their symbols. **Overload '<<' for easy output **because the data is stored in a file, overload the stream operator '>>' for easy input For example, suppose the infile is an ifstream object and the input file was opened using the object infile. Further suppose that myStock is a stock object. Then, the statement: infile >> myStock; reads the data from the input file and stores it in the object myStock. |
Write a program that mimics a calculator. The program should take as input two integers and the operation to be performed. It should then output the numbers, the operator, and the result. (for division, if the denominator is zero, output the appropriate message. |
Write a c++ program that declares an array alpha of 50 components of type double. Initialize the array so that the first 25 components are equal to the square of the index variable, and the last 25 components are equal to three times the index variable. Output the array so that 10 elements per line are printed. |
Write a program that prompts the user to enter a length in feet and inches and outputs the equivalent length in centimeters. If the user enters a negative number or non digit number, throw and handle an exception and prompt the user to enter another set. |
Write a program that allows the user to enter the last names of five candidates in a local election and the number of votes received by each candidate. The program should then output each candidate's name, the number of votes received, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election. A sample output is: Candidate Votes Received % of Total Votes Johnson____5000___________25.91 Miller______4000___________20.73 Duffy______6000___________31.09 Robinson___2500___________12.95 Ashtony____1800___________9.33 Total______19300 The Winner of the Election is Duffy. |
Write a recursive function to generate the following pattern of stars: (Underscores mean WHITESPACES, only used to create picture for this page) _*_ *_* *_*_* *_*_*_* *_*_* *_* * Also, write a program that prompts the user to enter the number of lines in the pattern and uses the recursive function to generate the pattern. For example, specifying 4 as the number of lines generates the above pattern. |
|
|
baexie wrote: |
---|
What is the 'trick behind it' new programmers won't see that you speak of? |
What is the 'trick behind it' new programmers won't see that you speak of? |
ResidentBiscuit wrote: |
---|
Hint, bitwise. |