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

Similar Threads
thread Thread Starter Forum Replies Last Post
Color ls terminal output for .h, .c, .cpp files robertneville77 OS X 10.8 Mountain Lion 3 Sep 22, 2013 07:41 PM
Linking to cpp-netlib Wnt2bsleepin Mac Programming 1 Aug 8, 2013 01:51 PM
what is the best Way to start programing? DavidBlack Wasteland 9 May 22, 2013 09:17 PM
Help with xcode (cpp file wont build) Hydrocity Mac Programming 1 Oct 5, 2012 04:37 AM
After System Update last night, the system will not boot with IOPlatformExpert.cpp:15 wonderingwhywhy iMac 1 Jun 12, 2012 10:03 AM

Forum Jump

All times are GMT -5. The time now is 09:48 PM.

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

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC