i dont no where my mistake is in these codes

i am new with c++,i am trying to make a header file .h , .c ,and a .cpp file
and then comoile them togeather in order to use the .h header file in the .cpp file the details are:
(the header file):
#ifndef AbsModule
#define AbsModule
int Abs (int);
float Abs (float);
double Abs (double);
#endif
(the excutive file .c):
#include <iostream>
#include "AbsModule.h"
using namespace std;
int Abs(int x){
return x>0 ? x: -x;}
float Abs(float x){
return x>0 ? x: -x;}
double Abs(double x){
return x>0 ? x: -x;}
(the .cpp file is):
#include<iostream>
#include "AbsModule.h"
using namespace std;
int main()
{
int Int=0
float Float=0;
double Double=0;
cout<<"Int:\t";cin>>Int;
cout<<"float:\t";cin>>float;
cout<<"double:\t";cin>>double;
cout<<endl<<endl;
cout<<"Int:\t"<<Abs(Int)<<endl;
cout<<"float:\t"<<Abs(float)<<endl;
cout<<"double:\t"<<Abs(double)<<endl;
system("pause");
return 0}
/////////////////////////////
notice please i am using dev c++
and the compiler gives me errors like:
In file included from AbsModule.c
expected init-declarator efore"float"
expected , or ; before float
and sometimes:
conflicting types of Abs


You forgot a semicolon after int Int=0
And you have capitalization problems after that. ( You chose bad names for your variables )

And please see http://www.cplusplus.com/articles/firedraco1/ to format code in the forum
Last edited on
dev c++


Please use a Newer IDE (such as Code::Blocks)

You chose bad names for your variables


Topic archived. No new replies allowed.