#include<iostream>
using namespace std;
struct voter
{
string name,add;
int id;
};
//declaring function
//structure object is the parameter
void display(struct voter v)
{
cout<<"
Voter ID: "<<v.id;
cout<<"
Name: "<<v.name;
cout<<"
Address: "<<v.add<<"
";
}
int main()
{
voter v1;
v1.id=1452145;
v1.name="Debasis Jana";
v1.add="Kolkata, West Bengal";
//calling the function using structure object
display(v1);
return 0;
}
#include<iostream>
using namespace std;
struct salary
{
int DA,TA,Total;
};
struct Employee
{
string name,add;
//declaring structure salary as a nested structure
struct salary s;
};
void display(struct Employee E1)
{
cout<<"
Name: "<<E1.name;
cout<<"
Address: "<<E1.add;
cout<<"
DA+TA: "<<((E1.s.DA)+(E1.s.TA));
cout<<"
Total Salary: "<<((E1.s.DA)+(E1.s.TA)+(E1.s.Total))<<"
";
}
int main()
{
Employee E;
//adding values to the member of Employee structure
E.name="Ankit";
E.add="Pune";
//Adding values to the member of salary structure
E.s.DA=1400;
E.s.TA=2800;
E.s.Total=36000;
//calling display function
display(E);
}
Code Example |
---|
Cpp :: spyder enviroment |
Cpp :: c++ loop through an array |
Cpp :: https://www.google |
Cpp :: play sound opencv video c++ |
Cpp :: c++ code |
Cpp :: how to traverse string like array in cpp |
Cpp :: how to complie c++ to spesific name using terminal |
Cpp :: how to run c++ on cmd |
Cpp :: syntax of member function in c++ |
Cpp :: how to list directory in c++ |
Cpp :: C++ Ranged Based for Loop |
Cpp :: Chef and IPC Certificates codechef solution in c++ |
Cpp :: c++ union set q5 |
Cpp :: android call custom managed method from native code |
Cpp :: nested loop c++ program example |
Cpp :: converter python to c++ code |
Cpp :: dualSort |
Cpp :: convert ros time to double |
Cpp :: c++ ascii value |
Cpp :: c++ is nan |
Cpp :: stack in c++ |
Cpp :: c++ for loops |
Cpp :: imgui menu bar |
Cpp :: c++ influenced |
C :: malloc is undefined |
C :: c remove last character from a string |
C :: disable lua errors |
C :: c data types |
C :: how to remove from a string c |
C :: pass the pointer to the function |