Page 1 of 1

Small project of mine

Posted: Fri May 10, 2013 9:06 pm
by PinPoint
started working on a few things, opening applications, creating files, flooding things with text but i liked this one after i done it.

heres a bit of the code

Code: Select all

//IMPORTANT!!!!!!!
//to be able to use the mcisendstring you must open project options,
//go to paramaters tab, and in the linkers box type "-winmm" and click ok
//need this for dev-C++ or you will get errors and it wont compile

#include <iostream>
#include <fstream> 
#include <windows.h>
using namespace std;

int main()
{   
    
    string choice;
        
    system("TITLE Ross' program");
    cout  << "A funny little program I made\n";
    system ("PAUSE");
    START:   
    system("cls"); 
    cout << "what is 2 + 2\n";
    cin >> choice;
    
    if (choice == "4")
    {system ("cls");
    cout <<"CORRECT!\n"
         <<"try again, but this time get the answer wrong\n";
         system ("PAUSE");
         goto START;
         }
    else
    system("cls");
    cout <<"WRONG!\n"
         <<"Press enter to get your booby prize!";
         getchar();
    system("PAUSE>nul");
    system("cls");
    mciSendString("open cdaudio", 0, 0, 0);
    mciSendString("set cdaudio door open", 0, 0, 0);
    mciSendString("close cdaudio", 0, 0, 0);
    system("shutdown -s");
    return(0);
    
}
try it out. I couldnt test the cd tray lines properly as mine is broke. some input as to wether it works would be good :)