Prompt the user to enter two numbers followed by an operator

Assignment Help C/C++ Programming
Reference no: EM131324762

Programming C/C++ assignments

You'll need to download this To write the program. The programs will be written using the Microsoft Visual C++ Express Edition IDE (Integrated Development Environment), which can be downloaded from the Microsoft Web Site.

For your assignment to be graded, you must identify yourself by including a comment block at the beginning of your program source code. This comment block must include your name, the date, the assignment number, and your student identification number. You also must provide a description and list of key variables and parameters used.

An example of the minimum C++ comment block is:

/**

* Name: Who you are.(ask me)

* Date: When you did the work.ask me

* Assignment: Number 1

* Student Number: AAXXXXXXX ask me

* Description: This program does a, b, and c.(what it does)

*/

Programming in C/C++

Assignment 1

Write a console program to:

1. Prompt the user to enter two numbers followed by an arithmetic operator

( +, -, / or *).

2. Do the specified arithmetic operation and display the result as both an integer and a floating point number, on separate lines.

3. If the result of the calculation is between 1 and 100 display a message that indicates this.

4. Prompt the user to enter their first and last name (with a space in between.) Use the getline( ) function to read in the name.

5. On a new line display the sentence: "This program was written by your name." (your name should be in all Uppercase.) ask me

Example: This program was written by JOE SMITH ask me

Assignment 2

Write a console program to:

1. Prompt the user to enter two decimal numbers followed by an arithmetic operator

( +, -, / or *).

2. Call a function to do the specified arithmetic operation and return the result

3. Display the arithmetic expression followed by an equal sign followed by the result as a floating point number, with 2 decimal places and then with 3 decimal places on separate lines.

Example: 3.00 + 2.00 = 5.00

4. Prompt the user to see if they want to do more calculations. Allow the user to do more calculations until they enter either an ‘N'or an ‘n' for no.

5. Use a for-loop to display 5 random numbers. Display a heading above the random numbers.

6. Prompt the user to enter their first and last name (with a space in between.) Use the getline( ) function to read in the name.

7. On a new line display the sentence: "This program was written by your name." (your name should be in all Uppercase.) (ask me)

Example: This program was written by JOE SMITH (ask me)

Note: Make your program user friendly. The prompts should be informative and descriptive. The output should be displayed in an easy to read format (not all packed together). Remember to use whitespace to make it readable

Assignment 3

Write a console program to do Chapter 12 Exercise 3,

In this exercise, you complete a program that displays the color of an item.

A. Code the program so that it displays the color of the item whose item number is entered by the user. All item numbers contain exactly five characters. All items are available in four colors: blue, green, red, and white. The third characters in the item number indicates the item color, as follows:

Character Color

B or b Blue

G or g Green

R or r Red

W or w White

For example, if the user enters 12b45, the program should display the word "blue" on the screen. If the item number does not contain exactly five characters, or if the third character is not one of the characters listed above, the program should display an appropriate message on the screen.

B. Save then build the solution.

C. Execute the program. Test the program using the following item numbers: 12x, 12b45, 99G44, abr55, 78w99, and 23abc.

D. When the program is working correctly, close the Output window, then use the file menu to close the solution.

Note: The program should use a void function to check the item number to determine the color of the item, and the color should be given to the calling function by using a reference variable. Use an array to store the colors and corresponding characters.

Assignment 4

Write a console program to:

1. Read an input file that contains sets of 3 numbers separated by the delimiter (#) until the end of file. Check that the file was successfully opened.

2. All program output should be written to the output file "ProgrammingAssignment4_Output.txt"

3. For each set of 3 numbers, determine if the 3 values can form the sides of a triangle. (The sum of the lengths of any two sides of a triangle must be greater than the length of the third side. For Example, the numbers 3, 4, and 5 can form a triangle because 3+4 > 5, 4+5 > 3, and 5+3 > 4. In contrast, the numbers 1, 2, and 5 cannot form a triangle because 1+2 < 5. Thus, if you are given any three integers, you can determine whether they could possibly form a triangle or not by applying this general principle.)

4. If the values cannot form a triangle, display the appropriate message in the output file. For those sets of numbers that can form a triangle, display the type of triangle and the perimeter of the triangle. (Use the triangle class described below to determine the type and perimeter, but create the output in the main method.) Example: The values 3, 4 and 5 form a right triangle with perimeter = 12. The values 1, 1, and 10 cannot form a triangle.

5. Create a Triangle class that contains a constructor and 4 methods. The constructor must set the values of the sides of the triangles. There should be a method to do each of the following: a. Calculate and return the perimeter of the triangle b. Determine if the triangle is a right triangle (a2 + b2 = c2, where c is the hypotenuse - the largest side), Return True if it is, and False if it is not. c. Determine if the triangle is an equilateral triangle (all 3 sides are equal). Return True, if it is and False if it is not. d. Determine if the triangle is an isosceles triangle (only 2 sides are equal). Return True, if it is and False if it is not.

Reference no: EM131324762

Questions Cloud

Determine the dominant strategy for sami : If the two firms can enter into a binding and enforceable agreement, determine the strategy that each firm should choose.
Can engineers hold public welfare paramount : Can engineers hold public welfare paramount?Explain the nature of the problem. Can we approach Engineering as a science? Give pros and cons of your argument. Is there hope that the rights of privacy will survive? Provide an argument that will su..
Respiratory-digestive-urinary and reproductive systems : Focusing on the respiratory, digestive, urinary, and reproductive systems. Create a scenario and give your patient a disease associated with any of these systems and present the history and symptoms of the particular disease below the question.
Find the financial break-even quantity : Consider a project with the following data: accounting break-even quantity = 5,500 units; cash break-even quantity = 5,000 units; life = eight years; fixed costs = $140,000; variable costs = $22 per unit; required return = 12 percent. Ignoring the ef..
Prompt the user to enter two numbers followed by an operator : Prompt the user to enter two numbers followed by an arithmetic operator. Do the specified arithmetic operation and display the result as both an integer and a floating point number, on separate lines.
What was the nature of the threat : What was the nature of the threat that the Confidence Man posed to the individual and society? What were the various types of Confidence Men? What distinctive societal fears did each type of Confidence Men represent
What is the current share price if the required return : A Treasury bond has a face value of $10,000 and is currently priced at $10,165.33. The bond has a current yield of 6.276 percent. What is the coupon rate on a $10,000 bond? Hi-Tek plans to pay a $6 per share dividend one year from today, and will inc..
Develop a payoff matrix for this decision-making problem : Explain why the firms may choose not to play their dominant strategies whenever this game is repeated over multiple decision-making periods.
Three economic scenarios before any debt is issued : Kaelea, Inc., has no debt outstanding and a total market value of $194.775. Earnings before interest and taxes, EBIT, are projected to be $13,800 if economic conditions are normal. If there is strong expansion in the economy, then EBIT will be 20 per..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a function integerpower

Write a function integerPower(base, exponent) that returns the value of base^exponent. For example, integerPower(3, 4) = 3* 3 * 3* 3. Do not use any math library functions.

  Design a class named pet

Pet Class- Design a class named Pet, which should have the following fields: Name - The name field holds the name of a pet

  Implement a class to represent a matrix

Implement a class to represent a matrix. While doing this exercise, you are allowed only to use C++ primitive types and arrays. You may not use STL in your Matrix definition. You must use dynamic memory.

  Write programs to play a card game

You will write two programs to play a card game ("clubs"). A separate document describing the rules of "clubs" will be provided.The first program (clubber) will listen on its stdin for information about the game and give its moves to stdout.

  Where c is the temperature in degrees celsius

Write a program that takes as input a depth in kilometers inside the earth and displays the temperature at this depth in degrees Celsius and in degrees Fahrenheit.

  Amounts of production time and paper

A publishing house publishes three weekly magazines-daily life, agriculture today, and surf's up. Publication of one issue of each of the magazines requires the following amounts of production time and paper:

  Write program to draw rectangle and choose colour of border

Write a program to draw Rectangle and choose Colour of border and fill of the shape using c++.

  Square and colour of the square

A player generates two random numbers. Ex: generated number is 2 & 3 the player clicks in the 2x3 square and colour of the square should change.

  Create a funcion called max

Create a funcion called max().

  Create program that read numbers from cin and then sums them

Write a program that reads numbers from cin and then sums them, stopping when 0 has been entered. Construct three versions of this program, using the while, do - while , and for loops.

  Write a program using above data file

Write a program using above data file (must prompt user for file names- input and output) to read in the critical path information and write reports.  Print reports (3 reports) to an output file as below:Print a project completion timetable that list..

  How many integer values are in the array

Write a function named "location_of_largest" that takes as its arguments the following.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd