Question: I am in learning stage of cpp(c++).Currently I am doing structures.I have write the following code but instead of getting input two times and giving

I am in learning stage of cpp(c++).Currently I am doing structures.I have write the following code but instead of getting input two times and giving output two times it is not working on the first part works perfeclty.

code:

#include using namespace std;

struct Person { char name[50]; int age; float salary; };

int main() { Person p1;

cout > p1.age; cout > p1.salary;

cout

Person p2;

cout > p2.age; cout > p2.salary;

cout

return 0; }

would you please tell me what i am doing wrong?I am in learning stage of cpp(c++).Currently I am doing structures.I have

C Microsoft Visual Studio Debug Console Enter Full name: joe Enter age: 21 Enter salary: 1234214 Displaying Information. Name: joe Age: 21 Salary: 1.23421e+06Enter Full name: Enter age: Enter salary: Displaying Information. Name: Age: -858993460 Salary: -1.07374e+08 C:\Users\RBTG source repos ConsoleApplication 12 \Debug\ConsoleApplication12.exe (process 14012) exited with code 0. To automatically close the console when debugging stops, enable Tools->Options ->Debugging->Automatically close the conso le when debugging stops. Press any key to close this window ... The bod1010 Stad Grade

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!