Hi!
can anyone tell me whats wrong with this:
Code:
#include <stdio.h>
struct com {char brand [80];
float price;
char colors;
char spec [100];
int gur; };
int main ()
{ int i; float min;
struct com computers[20];
computers[0].brand="Compaq";
computers[1].brand="IBM";
computers[2].brand="MAC";
computers[3].brand="Apple";
computers[4].brand="Dell";
computers[5].brand="ACER";
computers[0].colors='W';
computers[1].colors='B';
computers[2].colors='G';
computers[3].colors='O';
computers[4].colors='W';
computers[5].colors='G';
computers[0].price=122.35;
computers[1].price=1223.53;
computers[2].price=522.35;
computers[3].price=162.214;
computers[4].price=1212.311;
computers[5].price=120.035;
computers[0].spec="1.7 Ghrz, 512 DDRAM, 21 in Moniter, 256MB AGP";
computers[1].spec="3 Ghrz, 64 SDRAM, 14 in Moniter, 32MB AGP";
computers[2].spec="4 Ghrz, 32 RAM, 17 in Moniter, 12 MB AGP";
computers[3].spec="1.7 Ghrz, 512 DDRAM, 21 in Moniter, 256MB AGP";
computers[4].spec="1.0 Ghrz, 384 SDRAM, 15 in Moniter, 128MB AGP";
computers[5].spec="1.4 Ghrz, 128 SDRAM, 14 in Moniter, 64MB AGP";
computers[0].gur=1;
computers[1].gur=5;
computers[2].gur=2;
computers[3].gur=4;
computers[4].gur=3;
computers[5].gur=1;
printf ("***********************************");
printf ("* Computer Brand Price *");
printf ("***********************************");
for(i=0; i < 5; i++)
printf ("* %s %f *",computers[i].brand,computers[i].price);
printf ("***********************************");
for(i=0; i < 4; i++){
if (computers[i].price < computers[i+1].price)
min=computers[i].price;
else
min=computers[i+1].price; }
printf ("the cheapest price is %f",min);
for (i=0; i < 5; i++) {
float discount= 15 * computers[i].price /100;
printf("%3s%3c%3s%3f\n",computers[i].brand,computers[i].colors,computers[i].spec,computers[i].price - discount);
}
for(i=0; i < 4; i++){
if (computers[i].gur < computers[i+1].gur)
int max=computers[i+1].gur;}
printf ("the brand which has more period is %s",computers[i-1].brand);
return 0;
}
i always get this error: Lvalue required
plz help!!