All pastes #633010 Raw Edit

Unnamed

public cpp v1 · immutable
#633010 ·published 2007-07-25 11:05 UTC
rendered paste body
//StarTrek computer sounds (Voyager era)#include <assert.h>		//assertions#include <iostream>		//cout & cin#include <windows.h>	//for beep();#include <stdlib.h>		//for system(); stuff#include <time.h>		//needed for Wait();#define NUMBEEPS 7 //This is here so I don't forget to change itusing namespace std;void Wait( unsigned int msecs ){	clock_t goal = msecs + clock();	while( goal > clock() );}void DoNumBeep( int beepnum ){	switch( beepnum )	{		case 1: //Acknowledgement			cout<<"Voice Acknowledgement"<<endl;			Beep( 750, 125 ); //High			Wait( 30 );       //Sil            Beep( 750, 175 ); //High			break;				case 2: //Confirm 1			cout<<"Command Confirm 1"<<endl;		    Beep( 400, 200 ); //Low		    Wait( 20 );       //Sil			Beep( 750, 120 ); //High			Beep( 400, 150 ); //Low			break;				case 3: //Confirm 2			cout<<"Command Confirm 2"<<endl;			Beep( 750, 125 ); //High			Wait( 35 );       //Sil			Beep( 750, 125 ); //High			Beep( 400, 225 ); //Low			break;					case 4: //Confirm 3			cout<<"Command Confirm 3"<<endl;			Beep( 400, 225 ); //Low			Beep( 750, 125 ); //High			Wait( 35 );       //Sil			Beep( 750, 125 ); //High			break;		case 5: //Error 1			cout<<"Error 1"<<endl;			Beep( 750, 150 ); //High			Wait( 30 );       //Sil            Beep( 750, 150 ); //High			Beep( 220, 300 ); //Looooow			break;		case 6: //Error 2			cout<<"Error 2"<<endl;			Beep( 400, 200 ); //Low			Beep( 750, 280 ); //High			break;		case 7: //Doorbell			cout<<"Doorbell"<<endl;            Beep( 400, 200 ); //Looow			Wait( 5 );        //Sil            Beep( 400, 280 ); //Looow			Wait( 45 );       //Sil            Beep( 750, 180 ); //High			break;		default:            cout<<"Value out of range, MIN = 0, MAX = "<<NUMBEEPS<<endl;            break;    }}int main( ){    int beepnum;loopme:	beepnum = -1;	cout<<"Which beep? (1-"<<NUMBEEPS<<", 0 to exit): ";	cin>>beepnum;		if( beepnum == 0 )		exit( 0 );	//Idiot proofing, stops newbs from causing an infinite loop	assert( beepnum > -1 && beepnum < 9001 ); //IT'S OVER NINE-THOUSAAAAAAND!!    DoNumBeep( beepnum );	Wait( 500 );	system( "cls" );goto loopme;		return 0;}