| | |
calculate angle???
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2007
Posts: 55
Reputation:
Solved Threads: 0
I am using that but I only get some strange words 
I get my coordinates from x and y array..... what is the problem???

I get my coordinates from x and y array..... what is the problem???
C++ Syntax (Toggle Plain Text)
for(a=1;a<i;a++){ yyy=(y[a-1]- y[a]); xxx=(x[a-1]- x[a]); slope[a-1]=yyy/xxx;} yyy=(y[i-1]- y[0]); xxx=(x[i-1]- x[0]); slope[i-1]=yyy/xxx; for(b=1;b<i;b++){ yyy=(slope[b-1]+slope[b]); xxx=(1-slope[b-1]*slope[b]); angle=yyy/xxx; res=acos(angle) * (180/3.14); printf("%d. Angle %f\n",b,res);} yyy=(slope[i-1]+slope[0]); xxx=(1-slope[i-1]*slope[0]); lastangle=yyy/xxx; res=acos(lastangle) * (180/3.14); printf("%d. Angle %f\n",b,res);
Teach me, Show me, Educate me :)
C++ Syntax (Toggle Plain Text)
for(a=1;a<i;a++) { yyy = (y[a-1]- y[a]); xxx = (x[a-1]- x[a]); slope[a-1]=yyy/xxx; } yyy = (y[i-1]- y[0]); xxx = (x[i-1]- x[0]); slope[i-1]=yyy/xxx; for(b=1;b<i;b++) { yyy = (slope[b-1]+slope[b]); xxx = (1-slope[b-1]*slope[b]); angle = yyy/xxx; res = acos(angle) * (180/3.14); printf("%d. Angle %f\n",b,res); } yyy = (slope[i-1]+slope[0]); xxx = (1-slope[i-1]*slope[0]); lastangle = yyy/xxx; res = acos(lastangle) * (180/3.14); printf("%d. Angle %f\n",b,res);
yeah now i can read it.
- mike mclennan
ok, i am not 100% sure on what you are trying to do but I think you might want to add the second set to the first loop and the 4th set to the second loop. Or you might want to have 4 sets of loops there. I am not sure, but you are looping through the elements of a, but you are only doing the i element once... seems odd. but again I am not sure what you are trying to so. i see slope.... slope is math.
- mike mclennan
![]() |
Similar Threads
- The problem with using Java's maths.cos() (Java)
- Printing to Screen in a Class (C++)
- problem in creating a rectangle at a angle (C++)
- Calculate the factorial of a number (Visual Basic 4 / 5 / 6)
- hm.. wiered.. (C)
Other Threads in the C++ Forum
- Previous Thread: Heap block at 003D2CA0 modified at 003D2CB3 past requested size of b
- Next Thread: Linker -help needed
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator getline graph homeworkhelper iamthwee ifstream image input int integer java lib list loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings struct template text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






