ISO C++ forbids initialization of member 'chromatic'|
making 'chromatic' static|
invalid in-class initialization of static data member of non-integral type 'int [0]'|"
the following is my class
#ifndef _MUSICKEY_H
#define _MUSICKEY_H
#include<string>
using namespace std;
class musickey
{
public:
musickey();
musickey(const musickey &);
string SetKey();
string SetTonality();
string Scale();
private:
string chromatic[12];
string formula;
string temp;
int next,last;
chromatic[0] = "A";
chromatic[1] = "A#";
chromatic[2] = "B";
chromatic[3] = "C";
chromatic[4] = "C#";
chromatic[5] = "D";
chromatic[6] = "D#";
chromatic[7] = "E";
chromatic[8] = "F";
chromatic[9] = "F#";
chromatic[10]= "G";
chromatic[11]= "G#";
};
musickey::musickey()
{
formula = "WWHWWWH";
}
musickey::musickey(const &Object)
{
}
string musickey::SetKey(string inckey)
{
for(int i = 0; chrmoatic[i] != inckey ; i++)
{
last = (i+1);
}
return(last);
}
string musickey::SetTonality(string inctone)
{
if(inctone == "Major")
{
formula = "WWHWWWH";
}
if(inctone == "Minor")
{
formula = "WHWWHWW";
}
}
string musickey::Scale()
{
for(int i = 0; i < formula.length(); i++)
{
if(formula[i] == 'W')
{
next = 2;
}
if(formula[i] == 'H')
{
next = 1;
}
next += last;
if(next > 11)
{
next -=12;
}
last = next;
temp.append(chromatic[next]);
}
return temp;
}
#endif

New Topic/Question
Reply




MultiQuote








|