ok.. my problem is..
my midterm source code is due tomorw.. unfortunatly i cant get thsi music to play... my group REALLy wants the music and i thin itll boost my chances of an a... when i ran this music in the original(just the music) it runs fine.. when i put it in the iff statement in my code... i get 7000 errors... most complain about mmsystem.h:sad:

if i take out the mmsystem.h i get no errors for the most part and it runs like normal.. but no music.,...:cry:

i have left out mmsystem.h in this version.. if u run dev-c++ u have to add linker winlibmm.a using project options>>parameters>> add linker.

#include <iostream.h>
#include <iomanip.h>
#include <cstdlib>
#include <windows.h> 
using namespace std;
int main()
{
char gender;
char option;
char race;
int hp = 100;
int ehp = 100;
int str;
int intel;
int suck = 10;
int mp;
int armor;
int weapon;
int armor2;
cout << "Please choose your gender(M/F). ";
cin >> gender;
switch(gender)
       {
       case 'm':
       case 'M':
       cout << "You have chosen a male character. \n";
            cout << "Please choose your class.(Mage,Fighter,Archer.[M,F,A]) ";
            cin >> race; 
            switch(race)
             { //start of male race switch
             case 'm':
              case 'M':
              cout << "You have chosen the Mage. ";
              hp = 75;
                 str = 5;
                 intel = 15;
                 armor = 2;
                 mp = intel * 10;  
              break;
              case 'f':
               case 'F':
               cout << "You have chosen the Fighter. ";
               hp = 120;
                str = 15;
                intel = 5;
                armor = 5;
                mp = intel * 10;  
               break;
               case 'a':
               case 'A':
                    
               cout << "You have chosen the Archer. ";   
               hp = 100;
                str = 10;
            intel = 10;
            armor = 3;
            mp = intel * 10;  
               break;
 
               }//end of male race switch
          break;    
       case 'f':
       case 'F':
       cout << "You have chosen a female character.\n ";
            cout << "Please choose your class.(Mage,Fighter,Archer.[M,F,A]) ";
            cin >> race;   
            switch(race)
            {//start of female race switch
            case 'm':
            case 'M':
            cout << "You have chosen the Mage. ";
            hp = 75;
            str = 5;
            intel = 15;
            armor = 2;
            mp = intel * 10;  
            break;
            case 'f':
            case 'F':
            cout << "You have chosen the Fighter. ";
            hp = 120;
            str = 15;
            intel = 5;
            armor = 5;
            mp = intel * 10;  
            break;
           case 'a':
            case 'A':
            cout << "You have chosen the Archer. "; 
            hp = 100;   
            str = 10;
            intel = 10;
            armor = 3;
            mp = intel * 10;  
            break;
            
            }//end of F race switch
break;
            }//end of Gender
cout << "Choose your weapon.\n";
cout << "Katana(1). \n";
cout << "Great sword(2). \n";
cout << "Battle Staff(3). \n";
cout << "Silver bow(4). \n";
cout << "Winged Staff(5). \n";
cin >> weapon;
switch(weapon)
{
              case 1:
     cout << "You have chosen the Katana. \n";
     str = str + 3;
     break;
case 2:
     cout << "You have chosen the Great sword. \n";
     str = str + 5;
     armor = armor - 2;
     break;
case 3:
     cout << "You have chosen the Battle Staff. \n";
     str = str + 2;
     intel = intel - 2;
     break;
case 4:
     cout << "You have chosen the Silver Bow. \n";
     str = str + 2;
     armor = armor + 2;
     break;
case 5:
     cout << "You have chosen the Winged Staff. \n";
     intel = intel + 4;
     armor = armor + 1;
     break;
     }
     
cout << "Choose your armor.\n";
cout << "Chain armor(1). \n";
cout << "Leather armor(2). \n";
cin >> armor;
switch(armor)
{
case 1:
     cout << "You have chosen Chain armor.\n";
     armor = armor + 4;
     intel = intel - 2;
     break;
case 2:
     cout << "You have chosen Leather armor.\n";
     armor = armor + 2;
     break;
     }
cout << "An Oppel attacks! \n \n"; 
while(ehp > 0 && hp > 0)
{
cout << "Choose an option. Attack,Magic,Items,Run. \n";
cin >> option;
switch(option)
{
         case 'a':
         case 'A':
ehp = ehp - str;
hp = hp - (suck - armor);
suck++;
cout << "Your hp is " << hp << ". \n";
cout << "The Oppel's hp is " << ehp << ". \n"; 
cout << "Your mp is " << mp << ". \n";   
if(ehp < 0)
{
     
     ehp = 0;
     }    
         break;
         case 'm':
         case 'M':

ehp = ehp - intel;
hp = hp - (suck - armor);
suck++;
mp = mp - 10;
if(ehp < 0)
{
     
     ehp = 0;
     }
cout << "Your hp is " << hp << ". \n";
cout << "The Oppel's hp is " << ehp << ". \n";  
cout << "Your mp is " << mp << ". \n";
         break;
         case 'i':
         case 'I':
cout << "You have no items! \n";
         break;
         case 'r':
         case 'R':
cout << "You flee the Oppel in shame. \n";
         hp = 0;
         
         break;
         }

}
 
if(ehp <= 0)
{
         
         cout << "VICTORY! \n";
  cout << "Please wait...";
  
  
  mciSendString("play E:\ff7vict2.midi",NULL,0,NULL);
  
  
  cout << "\n\nPress Enter to stop ...";
  cin.get();
 
  mciSendString("stop E:\ff7vict2.midi",NULL,0,NULL);
}
if(hp <= 0)
 {                    
                    cout << "You have lost. \n";
                    cout << "GAME OVER!! \n";
            }        
         
system("PAUSE");
return 0;
}

Most likely due to the fact that most of the objects referenced in mmsystem.h are actually defined in winmm.lib -- a library you need to link your program with, or you'll get a ton of errors. In the compiler configuration, look for a list of .libs, then add winmm.lib to the end.

Hope this helps

well this code now has mmsystem.h in it BUT still no sounds... strange how i did nothing but add itin today ande im not getting errors frmo yesterday:(.

also. programmer isnt adding libwinmm.a thru project options>> parameters the same thing??(dev-C++)

#include <iostream.h>
#include <iomanip.h>
#include <cstdlib>
#include <windows.h> 
#include <mmsystem.h>
using namespace std;
int main()
{
char gender;
char option;
char race;
int hp = 100;
int ehp = 100;
int str;
int intel;
int suck = 10;
int mp;
int armor;
int weapon;
int armor2;
cout << "Please choose your gender(M/F). ";
cin >> gender;
switch(gender)
       {
       case 'm':
       case 'M':
       cout << "You have chosen a male character. \n";
            cout << "Please choose your class.(Mage,Fighter,Archer.[M,F,A]) ";
            cin >> race; 
            switch(race)
             { //start of male race switch
             case 'm':
              case 'M':
              cout << "You have chosen the Mage. ";
              hp = 75;
                 str = 5;
                 intel = 15;
                 armor = 2;
                 mp = intel * 10;  
              break;
              case 'f':
               case 'F':
               cout << "You have chosen the Fighter. ";
               hp = 120;
                str = 15;
                intel = 5;
                armor = 5;
                mp = intel * 10;  
               break;
               case 'a':
               case 'A':
                    
               cout << "You have chosen the Archer. ";   
               hp = 100;
                str = 10;
            intel = 10;
            armor = 3;
            mp = intel * 10;  
               break;
 
               }//end of male race switch
          break;    
       case 'f':
       case 'F':
       cout << "You have chosen a female character.\n ";
            cout << "Please choose your class.(Mage,Fighter,Archer.[M,F,A]) ";
            cin >> race;   
            switch(race)
            {//start of female race switch
            case 'm':
            case 'M':
            cout << "You have chosen the Mage. ";
            hp = 75;
            str = 5;
            intel = 15;
            armor = 2;
            mp = intel * 10;  
            break;
            case 'f':
            case 'F':
            cout << "You have chosen the Fighter. ";
            hp = 120;
            str = 15;
            intel = 5;
            armor = 5;
            mp = intel * 10;  
            break;
           case 'a':
            case 'A':
            cout << "You have chosen the Archer. "; 
            hp = 100;   
            str = 10;
            intel = 10;
            armor = 3;
            mp = intel * 10;  
            break;
            
            }//end of F race switch
break;
            }//end of Gender
cout << "Choose your weapon.\n";
cout << "Katana(1). \n";
cout << "Great sword(2). \n";
cout << "Battle Staff(3). \n";
cout << "Silver bow(4). \n";
cout << "Winged Staff(5). \n";
cin >> weapon;
switch(weapon)
{
              case 1:
     cout << "You have chosen the Katana. \n";
     str = str + 3;
     break;
case 2:
     cout << "You have chosen the Great sword. \n";
     str = str + 5;
     armor = armor - 2;
     break;
case 3:
     cout << "You have chosen the Battle Staff. \n";
     str = str + 2;
     intel = intel - 2;
     break;
case 4:
     cout << "You have chosen the Silver Bow. \n";
     str = str + 2;
     armor = armor + 2;
     break;
case 5:
     cout << "You have chosen the Winged Staff. \n";
     intel = intel + 4;
     armor = armor + 1;
     break;
     }
     
cout << "Choose your armor.\n";
cout << "Chain armor(1). \n";
cout << "Leather armor(2). \n";
cin >> armor;
switch(armor)
{
case 1:
     cout << "You have chosen Chain armor.\n";
     armor = armor + 4;
     intel = intel - 2;
     break;
case 2:
     cout << "You have chosen Leather armor.\n";
     armor = armor + 2;
     break;
     }
cout << "An Oppel attacks! \n \n"; 
while(ehp > 0 && hp > 0)
{
cout << "Choose an option. Attack,Magic,Items,Run. \n";
cin >> option;
switch(option)
{
         case 'a':
         case 'A':
ehp = ehp - str;
hp = hp - (suck - armor);
suck++;
cout << "Your hp is " << hp << ". \n";
cout << "The Oppel's hp is " << ehp << ". \n"; 
cout << "Your mp is " << mp << ". \n";   
if(ehp < 1)
{
     
     ehp = 0;
     }    
         break;
         case 'm':
         case 'M':

ehp = ehp - intel;
hp = hp - (suck - armor);
suck++;
mp = mp - 10;
if(ehp < 0)
{
     
     ehp = 0;
     }
cout << "Your hp is " << hp << ". \n";
cout << "The Oppel's hp is " << ehp << ". \n";  
cout << "Your mp is " << mp << ". \n";
         break;
         case 'i':
         case 'I':
cout << "You have no items! \n";
         break;
         case 'r':
         case 'R':
cout << "You flee the Oppel in shame. \n";
         hp = 0;
         
         break;
         }

}
 
if(ehp <= 0)
{
         
         cout << "VICTORY! \n";
  cout << "Please wait...";
  
  
  mciSendString("play E:\ff7vict2.mid",NULL,0,NULL);
  
  
  cout << "\n\nPress Enter to stop ...";
  cin.get();
 
  mciSendString("stop E:\ff7vict2.mid",NULL,0,NULL);
}
if(hp <= 0)
 {                    
                    cout << "You have lost. \n";
                    cout << "GAME OVER!! \n";
            }        
         
system("PAUSE");
return 0;
}

> also. programmer isnt adding libwinmm.a thru project options>> parameters the same thing??(dev-C++)

Yes, it is. I didn't mention libwinmm.a as an alternative option to winmm.lib if you're using Dev-C++.

It'll be kind of hard for me to debug your program though, as I'm not on a Windows machine, and I won't be able to compile/run your code. Just a thought, aren't you supposed to run

mciSendString("open C:\\path");

before you you try to play it. If I'm wrong, sorry because I've never actually used mmsystem.h, I just read that you have to do that in some online guide.

Another thing: in your paths, you're supposed to use double \\s to indicate that it's not an escape charecter! That could be the problem right there.

Another thing: in your paths, you're supposed to use double \\s to indicate that it's not an escape charecter! That could be the problem right there.

You can do the same thing with a single forward slash (/), its more portable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.