Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old Jan 4, 2013, 06:21 AM   #1
eyalt
macrumors newbie
 
Join Date: Jan 2013
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;
}
class:
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
header:
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!
eyalt is offline   0 Reply With Quote

 
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 07:57 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC