Skip to content

Instantly share code, notes, and snippets.

@2hanX
Created June 16, 2020 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2hanX/5183aede8fbb1e94ae61b113fd82db7c to your computer and use it in GitHub Desktop.
Save 2hanX/5183aede8fbb1e94ae61b113fd82db7c to your computer and use it in GitHub Desktop.
#include<iostream>
#include<string>
using namespace std;
struct Pizza
{
string company;
double diameter;
double weight;
};
void display(Pizza *pizza);
int main()
{
Pizza *p = new Pizza;
cout << "Enter the diameter of pizza: ";
cin >> p->diameter;
cin.get();
cout << "Enter the company name: ";
getline(cin, p->company);
cout << "Enter the weight of pizza: ";
cin >> p->weight;
display(p);
delete p;
return 0;
}
void display(Pizza *pizza)
{
cout << "Company: " << pizza->company << endl;
cout << "Diameter: " << pizza->diameter << endl;
cout << "Weight: " << pizza->weight << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment