By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,948 Members | 804 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,948 IT Pros & Developers. It's quick & easy.

i got some eror like "not a member" "parameter is never used" "undefined symbol" any

P: 1
#include <iostream.h>
#include <conio.h>

typedef int absis;
typedef int ordinat;

//Structure Poin & Garis
struct Poin
{
absis x;
ordinat Y;
};


struct Garis
{
Poin A;
Poin B;
};

#define absis(P) (P).x
#define ordinat(P) (P).y
#define ax(G) (G).A.x
#define ay(G) (G).A.y
#define bx(G) (G).B.x
#define by(G) (G).B.y

Poin CreatePoin(absis x, ordinat y);
void MovePoin(Poin *P,absis x,ordinat y);
Garis CreateGaris(Poin *P1, Poin *P2);
void CetakGaris(Garis G);

int main()
{
Poin P1,P2;
Garis G;

P1=CreatePoin(3,6);
P2=CreatePoin(9,4);

cout<<"Cetak Titik Garis";
G=CreateGaris(&P1,&P2);
CetakGaris(G);

getch();
clrscr();
cout<<"Posisi Titik Garis Berpindah";
MovePoin(&G.A,3,4);
MovePoin(&G.B,-3,-1);
CetakGaris(G);
getch();

return 0;
}

poin CreatePoin(absis x, ordinat y)
{
Poin P;
absis(P)=x;
ordinat(P)=y;
return P;
}

void MovePoin(Poin *P,absis x,ordinat y)
{
absis(*P)+=x;
ordinat(*P)|=y;
}

Garis CreateGaris(Poin *P1, Poin *P2)
{
Garis G;
G.A=*P1;
G.B=*P2;
return G;
}

void CetakGaris(Garis G)
{
gotoxy(ax(G),ay(G));cout<<"*";
gotoxy(bx(C),by(G)); cout<<"*";
}
Mar 19 '17 #1
Share this Question
Share on Google+
1 Reply


weaknessforcats
Expert Mod 5K+
P: 9,197
This code:

Expand|Select|Wrap|Line Numbers
  1. poin CreatePoin(absis x, ordinat y)
  2. {
  3.     Poin P;
  4.     absis(P) = x;
  5.     ordinat(P) = y;
  6.     return
  7. etc...
fails because it is incorrectly coded. absis and ordinat are types of int. So absis(P) is the same as int(P), which makes no sense.

What you intend is to place values in the x and y members of the variable P. So your code should look like:
Expand|Select|Wrap|Line Numbers
  1. poin CreatePoin(absis x, ordinat y)
  2. {
  3.     Poin P;
  4.     //absis(P) = x;
  5.     //ordinat(P) = y;
  6.     P.x = x;
  7.     P.Y = y;
  8.     return P;
  9. }
  10.  
You will need to make this fix in several places.
Mar 19 '17 #2

Post your reply

Sign in to post your reply or Sign up for a free account.