[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

5.4

help with writing a function statement

Asked by Lowrider in C Programming Language

Tags: npoint, double, error

Hello experts!

ok i'm having a hard time getting it right, ive read some tutorials etc thats how i got to the
point where i could write something but now that ive written this as a function i get errors:

Z:\Profil\Eigene Dateien\Test\Cpp1a.cpp(33) : error C2065: 'p1' : undeclared identifier
Z:\Profil\Eigene Dateien\Test\Cpp1a.cpp(33) : error C2228: left of '.x' must have class/struct/union type
Z:\Profil\Eigene Dateien\Test\Cpp1a.cpp(34) : error C2228: left of '.y' must have class/struct/union type
Z:\Profil\Eigene Dateien\Test\Cpp1a.cpp(36) : error C2065: 'p2' : undeclared identifier
Z:\Profil\Eigene Dateien\Test\Cpp1a.cpp(36) : error C2228: left of '.x' must have class/struct/union type
Z:\Profil\Eigene Dateien\Test\Cpp1a.cpp(37) : error C2228: left of '.y' must have class/struct/union type
Z:\Profil\Eigene Dateien\Test\Cpp1a.cpp(39) : error C2065: 'p3' : undeclared identifier
Z:\Profil\Eigene Dateien\Test\Cpp1a.cpp(39) : error C2228: left of '.x' must have class/struct/union type
Z:\Profil\Eigene Dateien\Test\Cpp1a.cpp(40) : error C2228: left of '.y' must have class/struct/union type

here is the code, keep in mind this is my first C program and I am a total newbie:

#include <stdlib.h>

#include <stdio.h>

double getCenter(double x1, double y1, double x2, double y2, double x3, double y3);

int main()

{

      double p1x = 0;
      double p1y = 0;
      double p2x = 0;
      double p2y = 0;
      double p3x = 0;
      double p3y = 0;

      printf ("Enter POINT 1 x co-ordinate: ");
      scanf ("%d",p1x);  
      printf ("\nEnter POINT 1 y co-ordinate: ");
      scanf ("%d",p1y);  
      printf ("\nEnter POINT 2 x co-ordinate: ");
      scanf ("%d",p2x);  
      printf ("\nEnter POINT 2 y co-ordinate: ");
      scanf ("%d",p2y);  
      printf ("Enter POINT 3 x co-ordinate: ");
      scanf ("%d",p3x);
      printf ("Enter POINT 3 y co-ordinate: ");
      scanf ("%d",p3y);  
 
      getCenter(p1x,p1y,p2x,p2y,p3x,p3y);

      printf("\nPoint 1 X:%f ", p1.x);
      printf(" Y:%f ", p1.y);

      printf("\n\nPoint 2 X:%f ", p2.x);
      printf(" Y:%f ", p2.y);

      printf("\n\nPoint 3 X:%f ", p3.x);
      printf(" Y:%f ", p3.y);

      printf("\n\nCenter Of Circle X:%f ", x);
      printf(" Y:%f ", y);

      printf("\n");

}


double getCenter(double x1, double y1, double x2, double y2, double x3, double y3)
{

      typedef struct point {
            double x;
            double y;
      } myPoint;

      myPoint p1;
      p1.x = x1;
      p1.y = y1;
      
      myPoint p2;
      p2.x = x2;
      p2.y = y2;

      myPoint p3;
      p3.x = x3;
      p3.y = y3;

      double math1 = p1.x*p1.x + p1.y*p1.y;
      double math2 = p2.x*p2.x + p2.y*p2.y;
      double math3 = p3.x*p3.x + p3.y*p3.y;

      double math4 = p1.x*(p2.y-p3.y) + p2.x*(p3.y-p1.y) + p3.x*(p1.y-p2.y);

      double x= (0.5)*(math1*(p2.y-p3.y) + math2*(p3.y-p1.y) + math3*(p1.y-p2.y)) / math4;
      double y= -(0.5)*(math1*(p2.x-p3.x) + math2*(p3.x-p1.x) + math3*(p1.x-p2.x)) / math4;

      return x,y;

}

could someone please help me out to sort this out? its probably something very easy and stupid
that i just dont see with my newbie eyes
 
Loading Advertisement...
 
[+][-]06/22/04 03:14 AM, ID: 11367597Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: C Programming Language
Tags: npoint, double, error
Sign Up Now!
Solution Provided By: ankuratvb
Participating Experts: 4
Solution Grade: A
 
[+][-]06/22/04 02:13 AM, ID: 11367287Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06/22/04 02:17 AM, ID: 11367311Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/04 02:18 AM, ID: 11367315Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/04 02:19 AM, ID: 11367321Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/04 02:20 AM, ID: 11367326Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/04 02:21 AM, ID: 11367331Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/04 02:21 AM, ID: 11367332Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/04 02:22 AM, ID: 11367339Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/04 02:22 AM, ID: 11367343Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/04 02:25 AM, ID: 11367360Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/04 02:26 AM, ID: 11367369Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/04 02:26 AM, ID: 11367373Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/04 02:28 AM, ID: 11367385Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/04 02:31 AM, ID: 11367395Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/04 02:32 AM, ID: 11367398Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/04 02:35 AM, ID: 11367415Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/04 02:37 AM, ID: 11367425Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/04 02:39 AM, ID: 11367435Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/04 02:42 AM, ID: 11367444Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/04 02:53 AM, ID: 11367488Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/04 02:58 AM, ID: 11367509Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/04 02:58 AM, ID: 11367513Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/04 02:59 AM, ID: 11367516Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/04 02:59 AM, ID: 11367518Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/04 03:00 AM, ID: 11367524Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/04 03:02 AM, ID: 11367535Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/04 03:03 AM, ID: 11367540Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/04 03:13 AM, ID: 11367588Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/04 03:14 AM, ID: 11367603Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/04 03:16 AM, ID: 11367627Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/04 03:20 AM, ID: 11367653Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/04 03:22 AM, ID: 11367674Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/04 03:31 AM, ID: 11367710Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06/22/04 03:31 AM, ID: 11367715Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06/22/04 03:40 AM, ID: 11367756Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/04 03:41 AM, ID: 11367762Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/04 03:43 AM, ID: 11367772Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/04 03:45 AM, ID: 11367779Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091118-EE-VQP-93