Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C programming (NOT C++) PLEASE USE STARTER CODE I ADDED AT THE END!! #include #include #include int main(void) { const int MAX_TITLE_CHARS = 44; //
C programming (NOT C++)
Write a program that reads movie data from a CSV (comma separated values) file and output the data in a formatted table (see movies, csv attached on Blackhoard). The program first reads the name of the CSV file from the user. The program then reads the CSV file and outputs the contents according to the following requirements: - Each row contains the title, rating, and all showtimes of a unique movie. - A space is placed before and after each vertical separator ("') in each row. - Column 1 displays the movie titles and is left justiffed with a minimum of 44 characters. - If the movie title has more than 44 characters, output the first 44 characters only. Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. - Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the CSV file contains the showtime, title, and rating of a movie. Assume data of the same movic are grouped in consecutive rows. Hints: Use the fgets() function to read each line of the input text file. When extracting texts between the commas, copy the texts character-by-character until a comma is reached. A string always ends with a null character ( 10 ). Erample: If the input of the program is movies.csv and the contents of novies. csv are: 16:40, Honders of the World, C 20:00, Wonders of the World,G 19:00, Journey to Space, ,PG-13 12:45, Buffalo Bi11 And The Indians or Sitting Bu11's History Lesson, PG 15:00, Buffalo Bill And The Indians or Sitting Bull's History Lesson, PG 19:30, Buffalo Bil1 And The Indians or Sitting Bu1l's History Lesson, PG 10:00,Adventures of Levis and Clark,PG-13 14:30, Adventures of Lewis and Clark,PG-13 19:00, Halloween, R the output of the program is Wonders of the Wor1d I G I 16:40 20:00 Journey to Space | PG-13 | 19:00 Buffalo Bil1 And The Indians or Sitting Bu11 I PG I 12:45 15:00 19:30 Adventures of Lewis and Clark | PG-13 | 10:00 14:30 Halloween I R | 19:00 PLEASE USE STARTER CODE I ADDED AT THE END!!
#include
#include
#include
int main(void) {
const int MAX_TITLE_CHARS = 44; // Maximum length of movie titles by
const int LINE_LIMIT = 100; // Maximum length of each line in the text file
char line[LINE_LIMIT];
char inputFileName[25];
/* Type your code here. */
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started