67 224
Assignments Done
99,2%
Successfully Done
In November 2018

Answer to Question #24385 in C++ for Nour

Question #24385
Suppose you have declared a struct called Movie. A Movie has a title, director, and running time. Declare a Movie variable called favorite, and set its fields equal to the information for your favorite movie.
Expert's answer
// In order to set title and director we should use thefunction // "strcpy" contained in the C-library strings.h.
// Therefore we need the next line
#include <string.h>

// define the struct
struct Movie {
chartitle[256]; // title of the film, itis assumed that is has length at most 256 symbols
chardirector[128]; // director of the file, it is assumed that is has length at
most 128 symbols
intrunning_time; // running time inminutes
};


int main()
{
struct Moviefavorite; // declare variable
strcpy(favorite.title, "Titanik"); // set title
strcpy(favorite.director, "James Cameron"); // set director
favorite.running_time = 194; // set running_time

return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions