Im new to c++ im tring to include my constructor, and it wants me to set the numerator equal to the first argument value and set the denominator equal to the second argumentvalue and call reduction. but when i try to add any constructor to the .cpp file i get these errors
c:\Documents and Settings\06019013\My Documents\Visual Studio Projects\lab5\lab5.cpp(12): error C2065: 'Rational' : undeclared identifier
c:\Documents and Settings\06019013\My Documents\Visual Studio Projects\lab5\lab5.cpp(12): error C2146: syntax error : missing ';' before identifier 'ration1'
c:\Documents and Settings\06019013\My Documents\Visual Studio Projects\lab5\lab5.cpp(12): error C3861: 'ration1': identifier not found, even with argument-dependent lookup
//Rational class interface
#ifndef RATIONAL_H
#define RATIONAL_H
private:
int numerator;
int denominator;
void reduction();
};
// lab5.cpp : Defines the entry point for the console application.
//
#include "Rational.h"
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
Rational ration1();
void reduction();
One thing is that the very last line - #endif - belongs at the end of the header file, not at the end of the .cpp file, unless it is just a copy-paste error.
Two other things in _tmain(): void reduction(); forward declares a function, it doesn't call it. And if you are intending to call the member function reduction() from there, you won't be able to because it is declared private.