Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Create a function named void testStruct02C() 2. Declare a FootballTeam struct pointer 3. Using cin and getline(), initialize the FootballTeam fields using the
1. Create a function named void testStruct02C() 2. Declare a FootballTeam struct pointer 3. Using cin and getline(), initialize the FootballTeam fields using the pointer Can use a statement like Football Team* fb01 = {"Buffalo Bills", "New York Jets", 33, 21); 4 Print out the Football Team struct using the pointer fb01 5 Fb01= returnStructPointer() 6 Print out the Football Team struct again using the pointer fb01 7. the first time you printed out fb01 (line 4) will be different than The output from printing fb01 (line 6) 8. the output printed in the function returnStructPointer() should be the same as the output from line 6 a function was added that you will need to modify named Football Team* returnStruct Pointer() { Declare a FootballTeam struct pointer named fb02 Using cin and getline(), initialize the Football Team fields using the pointer with different values than were used in initializing fb01 in function void testStruct02C() Can use a statement like Football Team fb02= ("Buffalo Bills", "New York Jets", 33, 21); Print out the Football Team struct using the pointer fb02 return the pointer to the calling function void testStruct02C() 22 RS #include... 25 using namespace std; 26 /************ struct definition 27 28 29 38 32 33 34 35 36 37 29 51 50 56 27 struct Football Tean { }; void teststruct82c(); 38Football Team returnStruct(); . Libraries here int main() { . . . . string tean; // tean name string opponent; // opponent name int teamscore; // teams score int oppoScore; // opponents score it should be the save as the struct printed in the called function teststruct82c(); return 0; creates gand initializes Football Team object creates a Football Team pointer makes the pointer point to the struct prints the object out (using the pointer) calls Football Teas returnStructPointer () which returns another Football Team pointer prints the object out using the new pointer void teststruct82c() II create a Football Teas struct void teststruct82c() { e} // create a Football Team struct // print out the Football Team struct // call returnstruct and receives struct pointer // print out the Football Team struct finction creates, initializes prints a Football Team struct then returns the struct ************ Football Tean returnStruct() // create a Football Tean object // initialize the fields // print out the FootballTean struct //return the pointer
Step by Step Solution
★★★★★
3.40 Rating (163 Votes )
There are 3 Steps involved in it
Step: 1
include Structure definition struct FootballTeam stdstring team stdstring opponent int teamScore int ...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