#include <iostream>
#include <cstdlib>
using namespace std;
struct Goods{
char Name[20];
char date[20];
char shelf_life[20];
float price;
float number;
};
int main()
{
Goods good;
cout << "Name: "; cin >> good.Name;
cout << "Date: "; cin >> good.date;
cout << "Shelf_life: "; cin >> good.shelf_life;
cout << "Price: "; cin >> good.price;
cout << "Number: "; cin >> good.number;
cout << "\nName: " << good.Name << endl;
cout << "Shelf_life: " << good.shelf_life << endl;
system("pause");
return 0;
}
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
#include <cstdlib>
using namespace std;
struct Goods{
char Name[20];
char date[20];
char shelf_life[20];
float price;
float number;
};
int main()
{
Goods good;
cout << "Name: "; cin >> good.Name;
cout << "Date: "; cin >> good.date;
cout << "Shelf_life: "; cin >> good.shelf_life;
cout << "Price: "; cin >> good.price;
cout << "Number: "; cin >> good.number;
cout << "\nName: " << good.Name << endl;
cout << "Shelf_life: " << good.shelf_life << endl;
system("pause");
return 0;
}