123456789101112131415161718192021222324252627
#include <iostream> using namespace std; struct movieData{ char title[30]; char name[30]; int year; int lenth; }; void output(movieData); int main() { movieData movie1 = {"Transformers", "Michael Bay", 2007, 144}; void output(movieData movie1); system("PAUSE"); return 0; } void output(movieData movie1) { cout << movie1.title; }
void output(movieData movie1); //line 17
1234567891011121314151617181920212223242526272829303132333435363738394041
//OutputStruct.cpp //Get some output #include <iostream> using std::cout; using std::cin; using std::endl; #include <string> using std::string; struct MovieData{ string title; string name; int year; int length; };//end struct MovieData void Output(MovieData movie); //function prototype int main(){ MovieData movie1={"Transformers","Michael Bay",2007,144}; Output(movie1); cin.ignore(); return 0; //indicates success }//end main void Output(MovieData movie){ cout<<movie.title<<'\n' <<movie.name<<'\n' <<movie.year<<'\n' <<movie.length<<'\n'<<endl; }//end function Output
Eyenrique-MacBook-Pro:Help Eyenrique$ ./OutputStruct Transformers Michael Bay 2007 144