Search This Blog

Loading...

Piano Game in C

/* Copy this code, Save it as .CPP and compile it. & Have a fun. */

#include<conio.h>
#include<dos.h>
#include<fstream.h>

void abc(int a)
{
    sound((a*8)/2);
    delay(300);
    nosound();
}

void main(int argc,char *argv[])
{
    char vij;
    fstream file1;
    file1.open(argv[1],ios::out);
    clrscr();
    cout<<"PIANO "<<"";

    cout<<"`q' to exit.";
   
    while(vij!='q')
    {
        abc(vij);
        vij=getch();
        if(vij!='q')
        file1.put(vij);
    }
    file1.close();
}

No comments:

Post a Comment