ぼるじょあがC/C++の宿題を片付けますYO! 39代目
■ このスレッドは過去ログ倉庫に格納されています
0351デフォルトの名無しさん
05/01/28 09:09:42#include <iostream>
struct Ware
{
int ID;
char name[256];
short category;
};
main()
{
Ware *wares = new Ware[3];
using namespace std;
for(int i=0; i<3; ++i)
{
wares[i].ID = i;
cout << "商品名入力:";
cin >> wares[i].name;
cout << "商品カテゴリ入力(食品:0,その他:1)";
cin >> wares[i].category;
}
for(int i=0; i<3; ++i)
cout << "ID:" << wares[i].ID << " 商品名:" << wares[i].name << " カテゴリ:"
<< (!wares[i].category ? "食品" : "その他") << endl;
delete[] wares;
}
■ このスレッドは過去ログ倉庫に格納されています