Hi fellow C programmers,
New to programming in C. The code below works fine showing everything except for tracks. It shows 0 tracks no matter what i put in. Can you tell me whats wrong?
ThanksCode:#include <stdio.h> main(){ char title[20]; char artist[10]; int tracks; char type[1]; int price; printf("Enter CD Title: \n"); scanf("%s",title); printf("Enter Artist Name: \n"); fflush(stdin); scanf("%[^\n]",artist); printf("Enter number of tracks on CD: \n"); scanf("%d",&tracks); printf("Enter 'A' for Album or 'S' for single: \n"); scanf("%s",type); printf("Enter CD Price: \n"); scanf("%d",&price); printf(" CD Information \n"); printf("-------------------\n"); printf(" Title: %s , Artist: %s , Tracks: %d , Album/Single: %s , Price: %d \n",title,artist,tracks,type,price); fflush(stdin); getchar(); }



LinkBack URL
About LinkBacks


