Help!!!

there are two errors which i cant figure out can u please help
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 #include<iostream>
#include<conio.h>
#include<math.h>
using namespace std;
class vectors
{
private:
    double x1,x2,y1,y2;
public:
    vectors ();
    vectors (int vx1 =0 , int vx2 =0 ,int vy1 =0 , int vy2 =0);
void    sets (int vx1,int  vx2, int vy1, int vy2)
    {
        x1=vx1;
        x2=vx2;
        y1=vy1;
        y2=vy2;
    }
double getx1()
    {
        return x1;
    }
double getx2()
{
    return x2;
}
double gety1()
{
    return y1;

}
double gety2()
{
return y2;
}
double calculate ()
{
    double ans;
    ans = sqrt(pow((x2-x1),2)-(pow((x2-x1),2)));
    return ans;

}
};
int main ()
{
    vectors v1();
    v1.sets(3,4,5,6);
    double resultm=v1.calculate();
    cout<<"Magnitude :"<<resultm<<endl;

}
closed account (o3hC5Di1)
Hi there,

could you please be more specific about which kinds of errors? If you are getting compile time / runtime errors, please paste them into your post as well.

Thanks,
NwN
C:\Users\Sharan Gohar\Documents\Homework.cpp\Trignometric.cpp||In function 'int main()':|
C:\Users\Sharan Gohar\Documents\Homework.cpp\Trignometric.cpp|47|error: request for member 'sets' in 'v1', which is of non-class type 'vectors()'|
C:\Users\Sharan Gohar\Documents\Homework.cpp\Trignometric.cpp|48|error: request for member 'calculate' in 'v1', which is of non-class type 'vectors()'|
||=== Build finished: 2 errors, 0 warnings (0 minutes, 0 seconds) ===|
Dude comon i am waitiing for ur reply
closed account (o3hC5Di1)
First off - there are others who need help and I'm not your personal code-monkey. Next time you want to get help I suggest trying to be polite to those offering it to you.

As for the problem:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include<iostream>
#include<conio.h>
#include<math.h>
using namespace std;
class vectors
{
private:
    double x1,x2,y1,y2;
public:
    vectors (); //remove this
    vectors (int vx1 =0 , int vx2 =0 ,int vy1 =0 , int vy2 =0);
void    sets (int vx1,int  vx2, int vy1, int vy2)
    {
        x1=vx1;
        x2=vx2;
        y1=vy1;
        y2=vy2;
    }
double getx1()
    {
        return x1;
    }
double getx2()
{
    return x2;
}
double gety1()
{
    return y1;

}
double gety2()
{
return y2;
}
double calculate ()
{
    double ans;
    ans = sqrt(pow((x2-x1),2)-(pow((x2-x1),2)));
    return ans;

}
};
int main ()
{
    vectors v1 = vectors();  //change this
    v1.sets(3,4,5,6);
    double resultm=v1.calculate();
    cout<<"Magnitude :"<<resultm<<endl;

}


Reason: http://stackoverflow.com/questions/877523/error-request-for-member-in-which-is-of-non-class-type

All the best,
NwN
I am sorry brv i did not want to offend you , maybe i got fraustrated not resolving the error thanks for your help you saved me one hour and i wish i could have re-payed you somehow.
Topic archived. No new replies allowed.