Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This program needs to be written in C. 1) Prompt the user for a title for data.

ID: 3804333 • Letter: T

Question

This program needs to be written in C.

1) Prompt the user for a title for data. Output the title. (1 pt)

Ex:


(2) Prompt the user for the headers of two columns of a table. Output the column headers. (1 pt)

Ex:


(3) Prompt the user for data points. Data points must be in this format: string, int. Store the information before the comma into a string variable and the information after the comma into an integer. The user will enter -1 when they have finished entering data points. Output the data points. Store the string components of the data points in an array of strings. Store the integer components of the data points in an array of integers. (4 pts)

Ex:


(4) Perform error checking for the data point entries. If any of the following errors occurs, output the appropriate error message and prompt again for a valid data point.

If entry has no comma

Output: Error: No comma in string. (1 pt)

If entry has more than one comma

Output: Error: Too many commas in input. (1 pt)

If entry after the comma is not an integer

Output: Error: Comma not followed by an integer. (2 pts)


Ex:


(5) Output the information in a formatted table. The title is right justified with a width of 33. Column 1 has a width of 20. Column 2 has a width of 23. (3 pts)

Ex:


(6) Output the information as a formatted histogram. Each name is right justified with a width of 20. (4 pts)

Ex:

Explanation / Answer

1. #include <stdio.h>

int main()
{
char *title ;
int size = 50 ;
printf("Enter a title for the data: ");
getline (&title, &size, stdin);
printf("You entered: %s ",title);
return 0;
}

2.

#include <stdio.h>

int main()
{
char *header1 ;
char *header2 ;
int size = 50 ;
  
printf("Enter the column 1 header: ");
getline (&header1, &size, stdin);
printf("You entered: %s ",header1);
printf("Enter the column 2 header: ");
getline (&header2, &size, stdin);
printf("You entered: %s ",header2);
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote