关于C++语法的问题:结构struct
大家好,我在编写程序时遇到一个关于结构struct的问题,想向大家请教.我在头文件Class前定义了一个结构,然后定义了一个这种结构类型的数组,并直接对其赋初值.但在编译时一直出错,总是说缺少大括号之类的错误.所以现在我只有先定义数组,然后在虚构函数内一个个赋初值,这样做行是行的通,但自己也知道很傻.大家帮我看看应该怎么解决.谢谢. #if !defined(AFX_PLAYSOUND_H__2419EC98_BC0B_4A69_AD07_6E82D182EC54__INCLUDED_)
#define AFX_PLAYSOUND_H__2419EC98_BC0B_4A69_AD07_6E82D182EC54__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
struct Sounds
{
CString ID;
CString FileInCE;
};
class PlaySound
{
public:
bool SoundPlayed(CString& FileName);
PlaySound();
virtual ~PlaySound();
struct Sounds SoundString[10]= {{"NL","My Documents\\Sound\\NachLinks.wav"},
{"NLR","My Documents\\Sound\\NachLR.wav"},
{"NL100","My Documents\\Sound\\NachLinks100.wav"},
{"NR","My Documents\\Sound\\NachRechts.wav"},
{"NR100","My Documents\\Sound\\NachRechts100.wav"},
{"NRL","My Documents\\Sound\\NachRL.wav"},
{"SG","My Documents\\Sound\\Signal.wav"},
{"SF","My Documents\\Sound\\SpzialFall.wav"},
{"SP","My Documents\\Sound\\Stop.wav"},
{"ZL","My Documents\\Sound\\Ziel.wav"}};
private:
bool Multiplexer(CString&);
};
#endif // !defined(AFX_PLAYSOUND_H__2419EC98_BC0B_4A69_AD07_6E82D182EC54__INCLUDED_)