Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a C Language Program. Must be a C Language program. Please follow the instructions given. Thank you. Must work with this file content also:

Create a C Language Program. Must be a C Language program. Please follow the instructions given. Thank you.
image text in transcribed
image text in transcribed
Must work with this file content also:
start,Hyrdraf,r,g,y,2,3,Ryujyin,b,g,w,1,2,Bakunakwa,r,b,g,2,2,Fafnirr,r,y,b,5,7
Problem 4(18 points)-Write a program Submit dragon.c Create a program that reads in a file of dragon information and outputs all dragons of a certain color using redirection (your code MUST match the sample run below). NO CREDIT IF YOU ATTEMPT TO READ THE FILE USING fopen Step 1: You will be creating a struct called dragon that holds the following information: 1. The name of the dragon 2. The colors of the dragon (given as letters). All dragons have 3 colors and the first letter of each color 3. 4. should be held in a char array. (r-red, b blue, w-white, g-green, y-yellow) The number of heads each dragon has The number of tails each dragon has Information for each dragon in the file will look like: Hyrdrafrgy,2,3 where Hydrafis the name, r,g.y are the colors (all held in the char array), 2 is the number of heads and 3 is the number of tails. Step 2: You will be defining the following two functions (DO NOT MODIFY THE DECLARATIONS): This function will take an array of dragon structs and input the information of all dragons given in the file into the array of dragon structs." void dragon info(dragon "d) /This function will take a char pointer indicating a color and an array of dragon structs. It will then output all dragons that have that color." void color(char color, dragon 'd) Step 3: Combine the struct and the two functions you defined above with the following main (DO NOT MODIFY) to create a working program. Do not hardcode since we will be testing with different colors and different files. int main (int argc, char "argv) dragon total[4 dragon info(total); char c 'b; color(&c, total); computer gcc-o dragon dragon.c computer./dragoncolors.txt computer$

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

From Herds To Insights Harnessing Data Analytics For Sustainable Livestock Farming

Authors: Prof Suresh Neethirajan

1st Edition

B0CFD6K6KK, 979-8857075487

More Books

Students also viewed these Databases questions

Question

Are there any questions that you want to ask?

Answered: 1 week ago