Answer to Question #152500 in C++ for LAIBA KANWAL

Question #152500
Q3: See this code, [2]
struct emp
{
int id_num;
char name[20];
string address[40];
}e;
main()
{
cout<< “I am calling function from here “<<Quiz(e1);
return 0;
}
Blue function call
A. Provides start address of a the struct emp;
B. Makes a function to function Quiz()
C. Passes the whole structure to the functions
D. Prints the structure
E. All of the above
Reason:
1
Expert's answer
2020-12-22T10:39:38-0500
#include <iostream>
using namespace std;
struct emp {
  int id_num;
  char name[20];
  string adresses;
  
} e;
void Quiz(struct emp e); 
int main () {
  struct emp e;
  cout << "Enter your id number: "; cin >> e.id_num;
  cout << "Enter your name: "; cin >> e.name;
  cout << "Enter your adress: ";
  cin.ignore();
  getline(cin, e.adresses);
  Quiz(e);
  return 0;
  
}
void Quiz(struct emp e) {
  cout << "Id Number: " << e.id_num << endl;
  cout << "Name: " << e.name << endl;
  cout << "Adress: " << e.adresses << endl;
}

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 the first!

Leave a comment

LATEST TUTORIALS
New on Blog