#include "stdafx.h"
#include "Windows.h"
#include <iostream>
#include <string>
usingnamespace std;
int _tmain(int argc, _TCHAR* argv[])
{
string symbol;
double number1;
double number2;
double answer;
cout << "What type of sum would you like to do? \n";
cout << "Please type the symbol for the sum you would like to complete \n";
cin >> symbol;
if (symbol == "+")
cout << "You have chosen Addition" << endl;
elseif(symbol == "-")
cout << "You have chosen Subtraction" << endl;
elseif(symbol == "/")
cout << "You have chosen Division" << endl;
elseif (symbol == "*")
cout << "You have chosen Multiplication" << endl;
else
{
cout << "You have not followed my instructions, the program will now exit!" << endl;
Sleep(5000);
return 0;
}
cout << "Please type your 1st number" << endl;
cin >> number1;
cout << "Please type your 2nd number" << endl << endl;
cin >> number2;
if (symbol == "+")
answer = number1 + number2;
elseif(symbol == "-")
answer = number1 - number2;
elseif(symbol == "/")
answer = number1 / number2;
elseif (symbol == "*")
answer = number1 * number2;
if (symbol == "/" && number2 == 0)
{
cout << "This is the only formula that is not yet supported, sorry about that! \nThe program will now exit!";
Sleep(5000);
return 0;
}
cout << "Your sum is:" << endl;
cout << number1 << " " << symbol << " " << number2 << " = " << answer << endl << endl << endl;
cout << "Thank you for using Advanced Calculator, made by DylanM!" << endl;
system ("pause");
return 0;
}
I know it is not much, but is there a free website i could check out for more tutorials or information? Because it gets hard to concentrate on a plain old book.
Study up on classes and arrays next, these are both essential concepts for a program of any significant size in C++. Here is the tutorial for this site, it's a bit dated but that's being worked on: http://www.cplusplus.com/doc/tutorial/
After you have those down you could probably pick up a library and "fill in the blanks" as you go along. As always I recommend SFML: http://www.sfml-dev.org/
There are some things that you will see that are commonly used, things like certain functions and dynamic containers. Instead of studying them directly and slowing yourself down you could learn them as they come up.