Saturday, 15 August 2015

c - ERROR : Expected Expression '/' before token -


This is my program. I am getting an error in the code that I could not debug, help me find the solution . I am getting this error: Expecting expression '/' token in the first line of the main function

  #include & lt; Stdio.h & gt; #include & lt; String.h & gt; #define NUM_CDS 100 #define TITLE_SIZE 70 # defined ARTIST_SIZE 70 int main () {/ ** declaration of variable ** / four heading [NUM_CDS] [TITLE_SIZE + 1]; Two-dimensional array with /// line size of 100 and type # 70, the Nordic four artist [NUM_CDS] [ARTIST_SIZE]; # Andif In Spot Tracks with NUMA / 70 Array 70 [NUM_CDS]; /// CD track available in four types; /// Whether the CD is the single or album int album [NUM_CDS]; Float value [NUM_CDS]; Int count = 0; /// How many CDs are tracked Int i; /// more; ("Welcome to the CD Shop"); Printf ("You can store up to% d cd.", Sizeof size / sizeof price [0]); Says ("======================================"); Fflush (stdin); / ** ** Loops they do not require more CDs until / / (;;) /// Loops are always convenient for this type of things {/ *** Program now for more entries from the user Asks *** / puts ("Do you want to store more data, yes for yes or not for N:"); Fflush (stdin); Scanf ("% c", & more); If (Tupar (type)! = 'Y') /// If user input is not equal to Y or Y, loop brake break; Printf ("\ n"); / ** For good practice we use new line ** ///// (more == 'Y' || more == 'Y' ?: break); /// Title description fputs ("Enter the title of the CD:", stdout); Fflush (stdin); Fgets (title [count], headline [count], stdin); Title [Count] [Stellen (title [counting]) - 1] = '\ 0'; #ifndef NOARTIST /// Artist Details Fputs ("Artist of CD": "Standout"); fflush (stdin); Fgets (artist); Size artist [count], stdin; Artist [Count] [Stellen (artist) [Count]) - 1] = '\ 0'; #endif /// track description printf ("how many tracks are in it:"); fflush (stdin); scanf ("% d", & tracks [count] ); /// The user has to ask if it is single for album or (;;)) If a valid entry is made then the loop exits from the only exit {printf ("album or single" (for album 'A 'Or' A 'for singles Left): "); Fflush (stdin); Scanf ("% c", & amp; Type); Type = topler (type); /// Only valid letters {A, A, S, S} are accepted if (type == 'A' || type == 's' || type ==' a '|| type ==' s ' )             break; Else {printf ("Re-enter the invalid entry. The valid entry is one, s, a, s. \ N"); /// fflush (stdin); }} Album [count] = type == 'a'; /// For user value ask printf ("dollar price in cd (enter this format in 6.30):"); Fflush (stdin); Scanf ("% f", & amp; value [count]); /// calculation + = 1; /// count increases and if prompted, then start next / ** check whether we have inserted an array of 100 elements / ** (++ calculation == NUM_CDS) {printf ("We maximize size Reached the limit \ n \ n "); break; }} / *** This is where the output section starts / i (i = 0; i  

  1. I think, that scanf ("% c" , & Amp ;;); should be scanf ("% c", and type);
  2. You can ; inserts (album [i]? "Album": "single")
  3. you #include & lt; Ctype.h & gt; for Tuper () function

After these changes, I am able to compile and run this program (which looks like) In Studio 2005


No comments:

Post a Comment