write the C++ program to do the following
1. read in 2 numbers as ints
2. calculate the sum, difference, product, and quotient
3. print out the four calculated numbers in the following
format
the two input numbers are ??? and ???
sum is ????
difference is ????
product is ????
quotient is ?????.??????
where ??? represents the ints and ????.???? represents the decimals. You can have any number of decimal places
Example:
Assume your 2 input numbers are 6 and 7
The output should look like
the two input numbers are 6 and 7
sum is 13
difference is -1
product is 42
quotient is 0.85714285
use your 'PLAN'
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
//initializes two variables of integer type
int num1,num2;
cin>>num1>>num2;//takes input from user
cout<<"the two input numbers are "<<num1<<" and
"<<num2<<endl;
cout<<"sum is "<<num1+num2<<endl; //calculates
the sum of two numbers
cout<<"difference is "<<num1-num2<<endl;
//calculates the difference of two integers
cout<<"product is "<<num1*num2<<endl;
//calculates the multiplication of two integers
float quotient=float(num1)/float(num2); //we explicitly converted
it to float to get the float result,otherwise we would have got an
integer result
cout<<"quotient is "<<quotient<<endl;
}
write the C++ program to do the following 1. read in 2 numbers as ints 2....
C++ program by using while loop structure. Write an interactive program (C++) to prompt and read two float type numbers, Then your program should perform and print the following arithmetic: (use while loop structure to repeat program 2 times. 1) Sum 2)Difference 3) Product 4) Quotient 5) Modulus (use system defined fmod function) You must use system's defined function prototype and/or to create programmer's defined function prototype for each of the above calculation. In addition, create a function called "DISPLAYLINE...
This is a C++ Program!!! Define a class called Rational that would represent rational numbers. Write a constructor that would accept two integers and initialize the numerator and denominator of the object to their values. Also include a default constructor that would initialize the numerator to 0 and denominator to 1. Implement the member functions add, sub, mul, div, less, and equal to carry out the operations +, -, *, /, <, and == (i.e., a + b would be...
Write a program in c++ that generates a 100 random numbers between 1 and 1000 and writes them to a data file called "randNum.dat". Then re-open the file, read the 100 numbers, print them to the screen, and find and print the minimum and maximum values. Specifications: If your output or input file fails to open correctly, print an error message that either states: Output file failed to open Input file failed to open depending on whether the output or...
in Java and also follow rubric please
4. Write a complete program to do the following: Using an input and output files, write a program that will read 20 numbers from an input file called InFile. Sum all even numbers and multiply all odd numbers. Print the numbers read from the input file to an output file called OutFile. Also print the sum of the even numbers and the product of the odd numbers to the output file. Rubric: •...
Language is C programming Student ID should be 8 numbers long. create a program to read your student ID number and store it in an array. Input can not be hard wired, I have to be able to input my number Then change the first number to a letter. If the same number repeats in other parts of your student ID, you must change that number to a letter as well. print original array and modified array as your output....
C- PROGRAMMING PROJECT #4 Design and Write a C program to calculate an average of an array of numbers and produce the following output: 1. Your first and last name 2. Course Number 3. C Project Number 4. All the numbers in the array 5. The sum of all the numbers in the array 6. The count of all the numbers in the array 7. The average of all the numbers in the array Double-space after lines 3, 4, 5,...
in c++ please
HW09: Read/Write File Ints Now that we've had a taste of what file I/O is all about, here's your chance to try it out on your own! You're to write a program that will prompt the user if he/she would like to read ints from a file (and have them displayed to stdout) or write ints to a file for safekeeping. If the user wishes to save a set of numbers, then the file nums.txt is opened...
Programming Language is Java Lab 1: Programming Exercises Input/Process/Output 1) Run the Numbers. Write a program with two input values. The program should display the sum, difference, quotient, product, and average of the two numbers. 2) Jake’s Problem. Jake has a car with an 8-gallon fuel tank. Jake fills his tank with gas and drives 60 miles to a friend’s house. When he gets to his friend’s house, he has 6 gallons left in his fuel tank. Write a program...
Use C++ Read numbers from a file and find the sum of numbers. Perform the following operations Read the console input and create a file.txt. $ in the console input is considered as an end of content for a file. Close the file after creation. Open the file in a read mode and read the numbers from a file and print the sum of all numbers. Input 77 124 2333 $ Where $ indicate an end of console input...
C Programming Write a program that meets the following requirements: • Your program will read three integer values from the keyboard. • Your program will output the following data in this order: 1. The third divided by the first if the first is not zero. 2. The third divided by the second if the first is zero and the second is not zero. 3. The sum of the first, second and third values. • All numbers are integers and only...