Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- //Structures, Classes and Pairs
- struct StudentDetails{
- int age;
- string name;
- };
- class Car{
- public:
- int seater;
- string model;
- int price;
- };
- int main(){
- StudentDetails student1; //
- student1.age = 14;
- student1.name = "Vaibhav";
- StudentDetails student2;
- student2 = {16,"Ram"};
- cout<<"Student 1 name is : "<<student1.name<<endl;
- cout<<"Student 2 name is : "<<student2.name<<endl;
- vector<StudentDetails> v;
- // for(int i = 0; i<3; i++){
- // StudentDetails temp;
- // int age;
- // string name;
- // cout<<"Age of Student "<< i<<endl;
- //
- // cin>>age;
- // cout<<"Name of Student "<< i<<endl;
- // cin>>name;
- //
- // temp.age = age;
- // temp.name = name;
- // v.push_back(temp);
- // }
- //
- // cout<<"2nd stud age : "<<v[1].age<<endl;
- Car c1;
- c1.seater = 4;
- c1.model ="Swift";
- c1.price = 700000;
- cout<<c1.model<<" have a price of "<<c1.price<<endl;
- pair<string,int> p;
- p.first = "Heloowww";
- p.second = 40; // p ={"hellowwww", 40}
- cout<<"first value of pair is : "<<p.first<<endl;
- vector<pair<int,string> > vec;
- pair<int,string> t;
- t={12,"Apple"};
- vec.push_back(t);
- vec.push_back({18,"Sony"});
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement