Code: //POinters #include using namespace std; int main() { int var = 9; int *ip; double *dp; float *fp; char *ch; ip=&var; //&= address of (saves address of variable var in ip) cout<<"Variable Value "< using namespace std; int main() { int size,i; int *ptr; cout<<"Enter size of an array"<>size; ptr = new int[size]; cout<<"Enter Array Elements to store\n"; for(i=0;i>ptr[i]; } cout<<"Values of Array are\n"; for(i=0;i #include #include #include #include using namespace std; class Cars{ public: string company_name; string model_name; string fuel_type; float milage; double price; public: setData(string cname, string mname, string ftype, float m, double p) { company_name=cname; model_name=mname; fuel_type=ftype; milage=m; price=p; } void displayData() { cout<<"\nCAR PROPERTIES"<

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Code:

//POinters

#include<iostream>

using namespace std;

int main()

{

int var = 9;

int *ip;

double *dp;

float *fp;

char *ch;

ip=&var; //&= address of (saves address of variable var in ip)

cout<<"Variable Value "<<var<<endl;

cout<<"Address saved in pointer "<<ip<<endl;

cout<<"Pointer pointing to value "<<*ip<<endl; *ip=50;

cout<<"\nVariable Value "<<var<<endl;

cout<<"Address saved in pointer "<<ip<<endl;

cout<<"Pointer pointing to value "<<*ip<<endl; }

//Dynamic Memory Allocation

#include<iostream>

using namespace std;

int main()

{

int size,i;

int *ptr;

cout<<"Enter size of an array"<<endl;

cin>>size; ptr = new int[size];

cout<<"Enter Array Elements to store\n";

for(i=0;i<size;i++)

{

cin>>ptr[i];

}

cout<<"Values of Array are\n";

for(i=0;i<size;i++)

{

cout<<ptr[i]<<endl;

}

for(i=0;i<size;i++)

{

cout<<"Address of"<<ptr[i]<<"Using Array is "<<ptr[i]<<endl;

}

}

//Concept of classes and objects

#include<iostream>

#include<string>

#include<string.h>

#include<stdio.h>

#include<conio.h>

using namespace std;

class Cars{

public:

string company_name;

string model_name;

string fuel_type;

float milage;

double price;

public:

setData(string cname, string mname, string ftype, float m, double p)

{

company_name=cname;

model_name=mname;

fuel_type=ftype;

milage=m;

price=p;

}

void displayData()

{

cout<<"\nCAR PROPERTIES"<<endl<<endl;

cout<<"Company Name \t"<<company_name<<endl;

cout<<"Modal Name \t"<<model_name<<endl;

cout<<"Fuel Type \t"<<fuel_type<<endl;

cout<<"Milage \t\t"<<milage<<endl;

cout<<"Price \t\t"<<price<<endl;

}

} ;

int main()

{

Cars car1,car2;

car1.setData("Suzuki","Mehran","Manual",2000,800000);

car1.displayData();

car2.setData("Tesle","beta","Electric",10.5,8000000);

car2.displayData();

return 0;

}

Note: Implement the concept of link list by using the above sample codes

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY