Here is my issue, I believe I got this down but am having the issue with the cmd prompt staying open long enough to capture screenshot. What did I do wrong with this?
// Have user choose 2 integers and prints various results
//
//
#include "Math.h"
#include <cmath>
#include <limits> // for INT_MIN AND INT_MAX
#include <istream>
#include <iostream>
using namespace std;
int main(int argc, char*argv[])
{
// Declare variables
// Displays messages to user
string user_input;
string yesCloseWindow;
int m;
int n;
// Displays a message to user
//Get user input
cout <<"Please enter positive a integer: \n "; // prints to screen to prompt user to enter a positive integer
cout<<argv[0];
char myLine[100];
cin.getline(myLine, 100);
cin >> m; // User inputs an integer and then stores it in integers m
cout<<argv[0];
char myLine[100];
cin.getline(myLine, 100);
// Displays a message to user
//Get user input
cout << "Please enter a second positive integer: \n "; // Prints to screen to prompt the user to enter a positve integer
cin >> n; // Inputs integers from user and stores it in integers n
cout<<argv[0];
char myLine[100];
cin.getline(myLine, 100);
// Displays a message to user
cout << "Sum:" << m + n <<endl; // Prints message to user
cout<<argv[0];
char myLine[100];
cin.getline(myLine, 100);
// Displays a message to user
cout << "Product:" << m * n << endl; // Prints message to user
cout<<argv[0];
char myLine[100];
cin.getline(myLine, 100);
// Displays a message to user
cout << "Difference:" << m - n << endl; // Prints message to user
cout<<argv[0];
char myLine[100];
cin.getline(myLine, 100);
// Displays a message to user
cout << "Difference:" << abs(m - n) << endl; // Prints message to user
cout<<argv[0];
char myLine[100];
cin.getline(myLine, 100);
// Displays a message to user
cout << "Quotient:" << (m + n) / 2 << endl; // Prints message to user
cout<<argv[0];
char myLine[100];
cin.getline(myLine, 100);
// Displays a message to user
cout << "Maximum:" << endl; // Prints message to user
cout<<argv[0];
char myLine[100];
cin.getline(myLine, 100);
// Displays a message to user
cout << "Minimum:" << endl; // Prints message to user
cout<<argv[0];
char myLine[100];
cin.getline(myLine, 100);
//Give user action to close window in order to take
//screenshot of window without having to run the program in cmd prompt
cout <<"Press Ctrl+Alt+delete to close window! \n ";
//Close the window
;getline(cin, yesCloseWindow);
cout<<argv[0];
char myLine[100];
cin.getline(myLine, 100);
#include "Math.h"
#include <cmath>
#include <limits> // for INT_MIN AND INT_MAX
#include <istream>
#include <iostream>
usingnamespace std;
int main(int argc, char*argv[])
{
// Declare variables
// Displays messages to user
string user_input;
string yesCloseWindow;
int m;
int n;
// Displays a message to user
//Get user input
cout <<"Please enter positive a integer:\n"; // prints to screen to prompt user to enter a positive integer
cin >> m; // User inputs an integer and then stores it in integers m
// Displays a message to user
//Get user input
cout << "Please enter a second positive integer:\n"; // Prints to screen to prompt the user to enter a positve integer
cin >> n; // Inputs integers from user and stores it in integers n
// Displays a message to user
cout << "Sum:" << m + n <<endl; // Prints message to user
// Displays a message to user
cout << "Product:" << m * n << endl; // Prints message to user
// Displays a message to user
cout << "Difference:" << m - n << endl; // Prints message to user
// Displays a message to user
cout << "Quotient:" << (m + n) / 2 << endl; // Prints message to user
// Displays a message to user
cout << "Maximum:" << endl; // Prints message to user
// Displays a message to user
cout << "Minimum:" << endl; // Prints message to user
//Give user action to close window in order to take
//screenshot of window without having to run the program in cmd prompt
cout <<"Press Ctrl+Alt+delete to close window! \n ";
//Close the window
system ("PAUSE");
return 0;
}
Thanks for the help. How can I define or declare the distance(absolute value of the difference) as well as max and min values in the program so they print to the screen?
I changed a couple lines and now I am getting these errors:
error LNK2019: unresolved external symbol "int __cdecl max(int,int)" (?max@@YAHHH@Z) referenced in function _main
Taketwo.obj : error LNK2019: unresolved external symbol "int __cdecl min(int,int)" (?min@@YAHHH@Z) referenced in function _main
fatal error LNK1120: 2 unresolved externals
// Write a program that prompts the user to pick two integers then calculates the following: sum, difference, product, average, absolute valus, min and max values.
//
//
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <string>
#include <iostream>
usingnamespace std;
int max(int, int);
int min(int, int);
int main()
{
int m, n;
cout <<"Enter number 1: \n ";
cin >> m;
cout << "Enter number 2: \n ";
cin >> n;
cout << "The largest of the two numbers is "
<< "The smallest of the two numbers is "
<< max (m, n) << min (m, n) << endl;
// Declare variables
;string yesCloseWindow;
if (m > n) return m;
elsereturn n;
if (n < m) return n;
elsereturn m;
cin >> m >> n;
cout << "Sum: " << (m + n) << endl; // Prints message to user
cout << "Product:" << m * n << endl; // Prints message to user
cout << "Difference:" << (m - n) << endl; // Prints message to user
cout << "Quotient:" << (m + n) / 2 << endl; // Prints message to user
cout << "Absolute: << sqrt(m - n) \n ";
//Give user action to close window in order to take
//screenshot of window without having to run the program in cmd prompt
getline(cin, yesCloseWindow);
//Close the window
system ("PAUSE");
return 0;
}
I didn't catch that problem!!
Min and max are what are needed to be discovered after the integers are entered in order to get the largest and smallest integers. I think I may have figured that out maybe!!!
// Design a program that prompts the user to pick two integers then calculates the following: sum, difference, product, average, absolute valus, min and max values.
//
//
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <string>
#include <iostream>
usingnamespace std;
int main( int argc, char* argv[])
{
// Declare variables
// Diplays message to user
string yesCloseWindow;
int m, n;
cout <<"Enter two integers: \n ";
cin >> m >> n;
//Displays message to user
cout << "Sum: " << (m + n) << endl; // Prints message to user
cout << "Product:" << (m * n) << endl; // Prints message to user
cout << "Difference:" << (m - n) << endl; // Prints message to user
cout << "Quotient:" << (m + n) / 2 << endl; // Prints message to user
cout << "Absolute:" << (m^2 - n^2) << endl; // Prints message to user
int largest;
cin >> largest;
if (m >= n) largest = m;
cout << "The largest number is: \n ";
int smallest;
cin >> smallest;
if (n <= m) smallest = n;
cout << "The smallest number is: \n ";
system("PAUSE");
return 0;
}