Reference no: EM133234606
Write code which allows the user to input three sets of data without using an array. Create three different sets of variables for each of the data items you're trying to input. The variables will be:
lastName1, lastName2, lastName3
pubYear1, pubYear2, pubYear3
pubCity1, pubCity2, pubCity 3
Each of these variables need to obey the rules set up for the error trapping on them: last names are 32 characters or less, city names are 64 characters or less, and the publication year is in [1477, 2022]. You will then use a counter variable to determine which set of variables you're on to receive input. Use a switch statement on the counter in order to assign data to the correct set of variables; counter 0 should go to set 1, which will be lastNmae1, pubYear1, and pubCity1, as an example.
At the end of the input, ask the user if they want to input another. If the user replies "No", you will then print out what they have entered, based on the counter again. If the user says "Yes" and they have entered less than three sets, the counter increases and the entire entry process is looped back to execute again. If all three sets have been entered, the loop doesn't ask the user anything, it just immediately prints out the information it has.
in C language