read to code given below and learn how to use structures in c++
#include<iostream>
#include<string>
using namespace std;
// badshah.hazor@gmail.com
// structure always start with keyword struct then name of structure
struct Worker{ // where Worker is a name of structure
string name;
string address;
double salary;
};
main(){
// creating objects inside the main function
struct Worker Ali, Assad; // we can define more then two objects as per requirments
// we will bind these object with structure's variable by using the dot "." oprator
Ali.name="Ali";
Ali.address="Home";
Ali.salary=20000;
Assad.name="Assad";
Assad.address="House";
Assad.salary=25000;
// we have saved the information of both Ali and Assad inside the structure
// now we will retrive these all information that we have saved recently
cout"\t\t\t\t****Badshah****\n\n";
cout"Name :"Ali.nameendl;
cout"Address:"Ali.addressendl;
cout"Salary :"Ali.salaryendlendl;
cout"\t\t\tSecond Worker\n\n";
cout"Name :"Assad.nameendl;
cout"Address:"Assad.addressendl;
cout"Salary :"Assad.salaryendlendl;
coutendl;
system("pause");
}
Please download the attachment file given below if the above code doesn't work
Tags:
gud wrk keep it up
Thanks alot for this aappreciation
© 2021 Created by + M.Tariq Malik.
Powered by
Promote Us | Report an Issue | Privacy Policy | Terms of Service
We are user-generated contents site. All product, videos, pictures & others contents on site don't seem to be beneath our Copyrights & belong to their respected owners & freely available on public domains. We believe in Our Policy & do according to them. If Any content is offensive in your Copyrights then please email at m.tariqmalik@gmail.com with copyright detail & We will happy to remove it immediately.
Management: Admins ::: Moderators
Awards Badges List | Moderators Group
All Members | Featured Members | Top Reputation Members | Angels Members | Intellectual Members | Criteria for Selection
Become a Team Member | Safety Guidelines for New | Site FAQ & Rules | Safety Matters | Online Safety | Rules For Blog Post