Write a C program to do the following: From the command line Read in two items,
ID: 3639017 • Letter: W
Question
Write a C program to do the following:From the command line
Read in two items, a short greater than zero and a character string less than 32
characters long, both on the same line.
Verify the short is a valid short.
Echo the pair back to the screen.
Write the pair to a ?le.
Be able to do this until the user is done entering a list. The list is N items long. You do
not know N at the start of the entering of the list.
After the user ?nishes entering the data, read the items from the ?le and print each pair
by line to the screen.
Do NOT make this very hard.
Explanation / Answer
#include #include #include #include int main() { short arr[100]; char str[100][32]; int n=0; printf("Now you will start entering numbers and string in order to stop enter -1 "); while(1) { int num; printf("Enter number: "); scanf("%d",&num); if(num>0 && numRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.