プロが教える店舗&オフィスのセキュリティ対策術

似たような質問を続けてしまって申し訳ないんですが、
listに構造体を格納するサンプルプログラム:

#include <iostream>
#include <cstdlib>
#include <stdio.h>
#include <list>
#include <vector>
using namespace std;

void main()
{

struct order{
double price;
double no;
double quantity;
};

list < struct <order> > B;
list < struct <order> > ::iterator iteB;

struct order Player1={1.1,10.,0.9};

iteB=B.begin();
B.insert(iteB,Player1);

struct order Player2={1.,11.,0.9};
double limit=Player2.price;

iteB=B.begin();
if(B.size()>0){
while((*iteB).price>=limit && iteB!=B.end())iteB++;
}


}

を作ってみました。
が、コンパイルエラーになってしまいます。
list < struct <order> > B;
が怪しいと思い、いろいろ試したのですが
どうしてもコンパイルが通りません。
どのようにすればよいでしょうか?

A 回答 (1件)

とりあえずコンパイルエラーがでないように直してみましたよ。

。。
BCC32で確認しました。

#include <iostream>
#include <cstdlib>
#include <stdio.h>
#include <list>
#include <vector>
using namespace std;

struct order{
double price;
double no;
double quantity;
};

void main()
{
list < struct order > B;
list < struct order > ::iterator iteB;

struct order Player1={1.1,10.,0.9};

iteB=B.begin();
B.insert(iteB,Player1);

struct order Player2={1.,11.,0.9};
double limit=Player2.price;

iteB=B.begin();
if(B.size()>0){
while((*iteB).price>=limit && iteB!=B.end())iteB++;
}

}


コンパイルエラー時にエラー内容がでると思いますが、
その内容をみてなおすだけです。
    • good
    • 1
この回答へのお礼

ありがとうございました。

お礼日時:2004/03/07 15:29

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!