c assignment 4
//Create a simple program that stores the values of 2 variables,
//Then perfoms the following operations and store the results in //at least one other variable: //-Addition //-Substration //-Multiplication //Preprocessor Directives //#include "StdAfx.h" #include <iostream> #include <string.h> using namespace std; //Global Declarations //Create my variables (Declaration) //*** Create variables to hold values double Variable1; double Variable2; //*** Create variable (s) to hold the result of the operations double OperationResult1, OperationResult2, OperationResult3; //Function Declarations float Addition_Operation(); //Define an object for a simple calculator class Simple_Calculator { public: //Data members double Variable1; double Variable2; double Result; //Function Set-UP: Initialize your data members int Set_Up() { Variable1 = 4; Variable2 = 6; Result = 0; } //Methods (members) double Addition() { //Perform Addition //*** Add Variable1 and Variable2 and save the result Result = Variable1 + Variable2; //*** Output the result on the screen cout << "The resulf of the Addition of " << Variable1 << " + " << Variable2 << " is " << Result << 'n'; } double Substraction() { } double Multiplication() { } }; //Main Function int main() { //Use Algorithm to outline the series of steps required to solve your problem //Algorithm: Structure Chart, Pseudocode, Flowchart //Create an object of type Simple_Calculator Simple_Calculator myCalculator; myCalculator.Set_Up(); myCalculator.Addition(); //Assign values to my variables Variable1 = 25; Variable2 = 00; //Call the Addition function: Function Call Addition_Operation(); //Perform Substration Operation //*** Substract Variable2 from Variable1 and save the result: Substract Operands from one another OperationResult2 = Variable1 - Variable2; //*** Output the result of the operation on the screen cout << "The resulf of the Substration of " << Variable1 << " - " << Variable2 << " is " << OperationResult2 << endl; //Perform Multiplication Operation //*** Multi;ply Variable2 by Variable1 and save the result OperationResult3 = Variable1 = Variable2; //*** Output the result of the operation on the screen cout << "The resulf of the Multiplication of " << Variable1 << " * " << Variable2 << " is " << OperationResult3 << endl; return 0; } //Other Function Definitions //Addition function float Addition_Operation() { //Perform Addition //*** Add Variable1 and Variable2 and save the result OperationResult1 = Variable1 + Variable2; //*** Output the result on the screen cout << "The resulf of the Addition of " << Variable1 << " + " << Variable2 << " is " << OperationResult1 << 'n'; } //Other Function Definition
Need your ASSIGNMENT done? Use our paper writing service to score good grades and meet your deadlines.
Order a Similar Paper Order a Different Paper