Author:
un quite

http://unquite.com/question-details/PRG-410-WEEK-2-ASSIGNMENT/765

or email us at:

PRG 410 WEEK 2 ASSIGNMENT

Problem 01 (20 Marks)

(Basic Input Output, Arithmetic Operators)

Write a C++ program, which can calculate Slope of a line ‘m’, by using formula. Ask from user values of y, x and b. You program calculate and print value of m.

Problem 02 (50 Marks)

(Basic Input Output, Arithmetic Operators)

‘math.h’ is a library, which contains different mathematical functions like cos, sin, tan, raise to power. You have to write a program, which can calculate following functions. Every equation has left side and right side. Your program must calculate both sides of following equation.

Problem 03 (30 Marks)

(Basic I/O, Nested If/Else)

Design a calculator that performs 4 basic operations (add, subtract, divide and multiply). When your program executes, it should ask the user to enter a simple expression of the format;

Operand1 Operator Operand2

e.g: 3 + 5, 7 / 5, 8 * 9, 10 – 4

You should use the data type ‘int’ for operands and the data type ‘char’ for the operator symbol. Your program should check the value of character variable using selection statement (if/else) and perform the operation accordingly. If user inputs “+” in character variable, you will add two numbers and do same for rest of the operations.

The output of your program must appear as shown in Fig-1 below;

Tutorial