עבר עריכה לאחרונה בתאריך 31.12.02 בשעה 21:08
התכנית הזאת זה מין אורגן כזה שאפשר לנגן איתו, והיא כוללת אפשרות של הקלטה+ השמעה של ההקלטה- והיא מאורגנת לפי תפריטים (תריץ אותה וכבר תבין) חסר שם רק הסוף שהוא משחק הזיכרון כלומר שהמחשב משמיע לך ואתה צריך לחזור אחריו מקווה שזה מה שרצית... אז הנה זה: (צירפתי גם את התכנית בקובץ טקסט)
http://rotter.net/User_files/nor/3e11eafd51ef1014.txt # include <stdio.h>
# include <conio.h>
# include <stdlib.h>
# include <time.h>
# include <dos.h>
int y1=10;
int y2=20;
int music;
int x1={5,11,17,23,29,35,41,47};
int x2={10,16,22,28,34,40,46,52};
int color={1,12,14,15,5,6,13,1};
int notes={270,305,340,365,415,465,515,540};
int recorder();
int randtone;
void showpiano() ;
void PlayNote( int Code);
void ShowNote(int code,int color);
void play();
void player( int n);
void showmenu();
void menu();
void playrand(int n);
# define ESC 27
void main()
{
menu();
}
void ShowPiano()
{
int code=0;
_setcursortype(_NOCURSOR);
textbackground(BLACK);
textcolor(WHITE);
clrscr();
while(code<8)
{
ShowNote(code+1,color); code++; } } void ShowNote(int code,int color) { window(x1,y1,x2,y2); textbackground(color); clrscr(); cprintf("\n\n %d",code); } int Translate(char ch) { int noteCode = 9 ; if(ch == '1') noteCode = 0; else if(ch == '2') noteCode = 1; else if(ch == '3') noteCode = 2; else if(ch == '4') noteCode = 3; else if(ch == '5') noteCode = 4; else if(ch == '6') noteCode = 5; else if(ch == '7') noteCode = 6; else if(ch == '8') noteCode = 7;
return noteCode; } void PlayNote( int Code) { sound(notes); ShowNote(Code,BLACK); delay(200); ShowNote(Code,color); nosound(); } void play() { char c; int Code; c=getch(); while(c !=ESC) { Code=Translate(c); if(Code !=9) PlayNote(Code+1); c=getch(); } } int recorder() { int counter,code; char ch; ShowPiano(); counter=0; ch = getch(); while(ch != ESC && counter < 100) { code = Translate(ch); if(code != 9) { PlayNote(code+1 ); music = code; } ch=getch(); counter++; } return counter; } void player( int n) { int counter=0; while(counter<n) { PlayNote(music+1); counter++; } } void showmenu() { window(1,1,79,24); textbackground(BLACK); textcolor( GREEN); clrscr(); printf("\n to play the piano -1"); printf("\n to record -2"); printf("\n hear to recording -3"); printf("\n to play memory game -4"); printf("\n to exit -ESC"); } void menu() { char c; int n; showmenu(); c=getch(); while(c!=ESC) { if(c=='1') { ShowPiano(); play(); } if(c=='2') n=recorder(); if(c== '3') { ShowPiano(); player(n); } showmenu(); c=getch(); } } void getrandtone(int n) { int counter=0; while(counter<n) { randtone = rand()%8; counter++; } } void playrand(int n) { int counter=0; while(counter<n) { PlayNote(randtone); delay(300); counter++; } } http://rotter.net/User_files/nor/3e11eafd51ef1014.txt
|