Created
June 16, 2020 10:52
-
-
Save 2hanX/5183aede8fbb1e94ae61b113fd82db7c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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