Hello I wrote this program there is a mistake on lune 54 but I figure out what it is. I tried to fix it but without any luck. THe program askes the user for an input then it ask's the user to select a port that they want to go to (In this case the port will always be sydney".
Then it prints out the list of materials it sells in Sydney and their prices.
Code:#include <stdio.h> #include <stdlib.h> #include <time.h> #define A 100 #define SIZE 2 typedef struct{ float Fish; float Cotton; }Goods_g; typedef struct{ char Sydney; }Ports_p; int Sydney(Goods_g *G, Ports_p *P, float variables[SIZE]); int main() { Goods_g *G; Ports_p *P; char name[A]; int i; int x=1000; float variables; int j; variables[SIZE]; printf("Please enter your name: "); scanf("%s",&name); printf("Please select which pont you want to start in: "); scanf("%d",&i); if(i==1) printf("Welcome to Sydney\n"); if(i>1 || i<1) printf(" you must enter 1\n"); srand((unsigned)time(NULL)); for (j=0; j<2; j++) variables[j] = (rand()%26)/14.0f; Sydney(G, P, variables[]); //Line 54 the mistake is in this line but i can'nt figure out what it is. return 0; } int Sydney(Goods_g *G, Ports_p *P, float variables[SIZE]) { G->Fish==50*variables[0]; G->Cotton==80*variables[1]; printf("Welcome to %s\n",P->Sydney); printf("The prices for the material is as follows\n"); printf("Fish=%f\n", G->Fish); printf("Cotton=%f\n", G->Cotton); return 0; }



LinkBack URL
About LinkBacks


