// Calculator v1.0.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
usingnamespace std;
double firstnum;
double secondnum;
char operation;
class Addition
{
public:
int add(firstnum,)
//got two errors up there^^ it thinks im creating a new type
private:
}
int _tmain(int argc, _TCHAR* argv[])
{
cout<<"Welcome to my calculator app!"<<endl;
cout<<"Input your first number:"<<endl;
cin>>firstnum;
cout<<"Now, input your operation: +,*,-";
cin>>operation;
return 0;
}
First, initialize those 3 global variables. Uninitialized variables can result in volatile behaviour, which is not what you want.
Second, in the parameter list of Addition::add( ), firstnum must have a type-specifier associated with it. Also, remove the comma and place a semi-colon after the parameter list. Don't forget to provide a body for Addition::add( ).
Before using a class, you must instantiate it. This basically means create an object that is of type Addition. After you've done that, you can invoke the methods of Addition using the dot operator (or member access operator), like so: