|
|
#1 |
|
question about CPP programing
hi, i tried to compile this program and the compiler gave me this massage: "invalid use of 'class circle1'.
im quiet new at progrming and i have no idea what i did wrong. any help will be appricieted... this is my code: main: Code:
#include <iostream>
#include <fstream>
#include "circle1.h"
#include "tri.h"
using namespace std;
int main()
{
int x,y;
circle1 r;
cout<<"enter numbers";
cin>>x>>y;
r.circle1(x);
return 0;
}
Code:
#ifndef CIRCLE1_H_INCLUDED
#define CIRCLE1_H_INCLUDED
class circle1
{
private:int r;
public:
void clch(int);
void clcs(int);
circle1(int);
circle1();
};
#endif // CIRCLE1_H_INCLUDED
Code:
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include "circle1"
using namespace std;
circle1::circle1(int x)
{
if(x<0)
cout<<"the number you enterd is negative!";
else
{
r=x;
void clch(int x);
void clcs(int x);
}
}
void circle1::clch(int x)
{
x=x*2*M_PI;
cout<<"this is the hikef of the first circle: "<<x<<"\n";
}
void circle1::clcs(int x)
{
x=2*M_PI*(pow(x,2));
cout<<"this is the sheth of the first circle: "<<x<<"\n";
}
Last edited by robbieduncan; Jan 4, 2013 at 06:34 AM. Reason: Please use the nifty code tags! |
|
|
|
0
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 07:57 PM.







Threaded Mode