}
#include <stdio.h>
#include <string.h>
struct cd_detail
{
char group[20];
char name[50];
int year;
double price, playtime,costTotal;
}
cd[7]={{"Alan","Tibet sing",2008,51,600},
{"Thubasa","Fly away",2007,52,700},
{"Alan","I love China",2010,53,500},
{"pitbull","Jump to jump",2005,54,720},
{"pitbull","crazy mix",2009,48,630},
{"pitbull","Let we ROCK",2010,49,608},
{"Alan","Sakura mansume",2010,56,909}};
void main()
{
char group[20];
int k;
printf("Enter group>");
gets (group);
printf("Name \tYear \tPrice \tPlaytime\n");
printf("========\t=======\t======\t=============\n");
for(k=0;k<7;k++)
{
if(strcmp(strlwr(group),strlwr(cd[k].group))==0)
printf("%s \t %d \t %.2f\t %.2f \t\n", cd[k].name,cd[k].year,cd[k].price,cd[k].playtime);
}
printf("CostTotal >%.2f",cd[k].costTotal);
printf("\n");
Halo guy and girls i am first time to learning programming and now my problem is how to take the CostTotal i want for after display all the details about group i try many time still no idea to write the code to find the totals