|
Mostrar Temas
|
Páginas: [1]
|
1
|
Programación / Programación C/C++ / error en codigo fuente de Rocola [C++]
|
en: 16 Marzo 2011, 03:51 am
|
Hola amigos pues tengo un programa que hace una emulacion de rocola pero no encuetro unos errores en los if. por mas que le busco y muevo no le busco no me doy cuenta. Si me pueden ayudar? Les dejo el codigo; #include <windows.h> #include <mmsystem.h> #include <cstdlib> #include<stdio.h> #include<conio2.h> #include<conio.h> #include<string.h>
using namespace std; int e,n,n2,n3; int main() {
textcolor(13); printf("\n\n \2\2\2\2 Repertorio musical \2\2\2\2 \n\n "); Sleep(1000); printf("\n\n Bienvenidos a la fase beta del repertorio musical"); printf("\n\n Seleccione el genero de su gusto"); Sleep(1000); printf("\n\n\n 1._Metal/Rock \n\n\n\n 2._Trance \n\n\n\n 3._Clasica/blues \n\n\n\n \n\n"); scanf("%d",&e); if(e==1) { //abrir ife1 metal system("cls"); printf("\n Metal/Rock"); Sleep(1000); printf("\n\n\n 1._Smoke on the wather - Deep Purple \n\n\n 2._ Whiskey in the jar-Metallica \n\n\n 3._The end of heartache-Killswichtengage \n\n "); scanf("%d",&n); if(n==1) {//abrir if2 smoke system("cls"); gotoxy(110,1);cprintf(" \6 Smoke on the Water-Deep Purple \6 "); printf("\n\n Es una cancion del grupo de hard rock britanico Deep Purple, \n\n lanzada en el influyente album Machine Head, \n\n tiene una duracion de estudio de 5:40.\n\\n\Es también muy conocida su version en directo del album Made in Japan, de 1972."); char soundfile[] = "C:/Users/Jorge/Desktop/Music/Smokeonthewather.wav"; PlaySound((LPCSTR)soundfile, NULL, SND_FILENAME | SND_ASYNC ); getch(); }//cerrar if2 else { if(n==2) {//wiskey system("cls"); printf(" \6 Wiskey in the jar-Metallica \6 n\n "); printf(" Duracion: 5:30 min"); printf("Artista: Metallica-2002"); char soundfile[] = "C:/Users/Jorge/Desktop/Music/whiskey.wav"; PlaySound((LPCSTR)soundfile, NULL, SND_FILENAME | SND_ASYNC ); getch(); } else { if(n==3) {//the end of heardttach system("cls"); gotoxy(110,1);cprintf(" \6 The end of heardtache-Killsich engage \6 "); printf(" \n\n(Al final de la angustia) es un album musical del grupo\n\nde metalcore estadounidense Killswitch Engage.\n\n Salio a la venta en Estados Unidos el 11 de mayo de 2004.\n\n La cancion que le hace honor al album, es decir, de nombre homonimo a éste, \n\n fue usada en el soundtracks de la pelicula Resident Evil: Apocalipsis. \n\n \n\n ."); char soundfile[] = "C:/Users/Jorge/Desktop/Music/kill.wav"; PlaySound((LPCSTR)soundfile, NULL, SND_FILENAME | SND_ASYNC ); getch(); } } }//cerrar ife1 metal else {//abrir else de ife1 trance system("cls"); printf("\n\n Trace"); printf("\n\n 1._Hydro acuatic \n\n 2._Take over control"); scanf("%d",&n2); if(n2==1) //abrir if de n2 { system("cls"); gotoxy(110,1);cprintf(" Hydro acuatic " ); printf("\n\n Set de trance producido por el DJ Dash Berlin en el año 2010 durante \n\n la gira en que tambien estubo en Mexico"); char soundfile[] = "C:/Users/Jorge/Desktop/Music/acuatic.wav"; PlaySound((LPCSTR)soundfile, NULL, SND_FILENAME | SND_ASYNC ); getch(); }//cerrar if de n2 else { //abrir else de if n2 if(n2==2) {//abrir opcion 2 de n2 system("cls"); gotoxy(110,1);cprintf(" Take Over Control"); printf(" Set producido por +Nescafe en el año 2010 y se expuso \n\n en el IBIZA de 2010 ganando varios premios tras integrar trance-house"); char soundfile[] = "C:/Users/Jorge/Desktop/Music/over.wav"; PlaySound((LPCSTR)soundfile, NULL, SND_FILENAME | SND_ASYNC ); getch(); }//cerrar else de if n2 } }//cerrar else de ife1 trance if(e==3) //abrir else de ife1 de clasica blues { system("cls"); printf("\n\n Clasica/Blues"); printf("\n\n 1._imagine \n\n2._cold\n\n"); scanf("%d",&n3); if(n3==1) { system("cls"); gotoxy(110,1);cprintf(" Imagine-Arpa Celta"); printf(" Esta cancion es producida en el año 2010 por la orquesta de Arpa Celtika real. Mas informacion En su pagina oficial "); char soundfile[] = "C:/Users/Jorge/Desktop/Music/imagine.wav"; PlaySound((LPCSTR)soundfile, NULL, SND_FILENAME | SND_ASYNC ); getch(); } else { if(n3==2) { system("cls"); gotoxy(110,1);cprintf(" Cold-ATB Secion Instrumental "); printf(" Este es un Set que esta disponible en exclusive por $100 pesos por cancion, \n\n integramos este set de TRACE/CLASIC unica y exclusiva por el DJ ATB"); char soundfile[] = "C:/Users/Jorge/Desktop/Music/cold.wav"; PlaySound((LPCSTR)soundfile, NULL, SND_FILENAME | SND_ASYNC ); getch(); } } }
else { printf("nada"); }
}
es ese.. no le encuentro error alguno Muchas gracias
|
|
|
2
|
Programación / Programación C/C++ / SDL insertar imagenes [lenjuage C]
|
en: 8 Marzo 2011, 18:30 pm
|
Hola amigos ando iniciando en DevC++ con SDL y hay un codigo ejemplo que trae entonces quiero modificarlo e insertar una imagen, pero como? es posible?.. Ando iniciando en este mundo del SDL #include <stdio.h> #include <stdlib.h> #include <string.h> #include <SDL/SDL.h> #include <windows.h>
/* PLEASE NOTE: the program will require SDL.dll which is located in dev-c++'s dll directory. You have to copy it to you program's home directory or the path. */
/* The screen surface */ SDL_Surface *screen = NULL;
/* This function draws to the screen; replace this with your own code! */ static void draw () { static int direction = 0; static int value = 0; static int which = 0; SDL_Rect rect; Uint32 color;
/* Create a black background */ color = SDL_MapRGB (screen->format, 0, 0, 0); SDL_FillRect (screen, NULL, color);
/* Determine which color the layer should have */ if (direction == 0) { value += 2; if (value >= 256) { value = 255; direction = 1; } } else { value -= 2; if (value <= 5) { value = 0; direction = 0; which++; if (which == 5) which = 0; } }
/* Draw a layer with variable color */ switch (which) { case 0: color = SDL_MapRGB (screen->format, value, 0, 0); break; case 1: color = SDL_MapRGB (screen->format, 0, value, 0); break; case 2: color = SDL_MapRGB (screen->format, 0, 0, value); break; case 3: color = SDL_MapRGB (screen->format, value, value, value); break; case 4: color = SDL_MapRGB (screen->format, value, 0, value); break; }
rect.w = screen->w / 2; rect.h = screen->h / 2; rect.x = (screen->w / 2) - (rect.w / 2); rect.y = (screen->h / 2) - (rect.h / 2); SDL_FillRect (screen, &rect, color);
/* Make sure everything is displayed on screen */ SDL_Flip (screen); /* Don't run too fast */ SDL_Delay (3); }
int main (int argc, char *argv[]) { char *msg; int done;
/* Initialize SDL */ if (SDL_Init (SDL_INIT_VIDEO) < 0) { sprintf (msg, "Couldn't initialize SDL: %s\n", SDL_GetError ()); MessageBox (0, msg, "Error", MB_ICONHAND); free (msg); exit (1); } atexit (SDL_Quit);
/* Set 640x480 16-bits video mode */ screen = SDL_SetVideoMode (640, 480, 16, SDL_SWSURFACE | SDL_DOUBLEBUF); if (screen == NULL) { sprintf (msg, "Couldn't set 640x480x16 video mode: %s\n", SDL_GetError ()); MessageBox (0, msg, "Error", MB_ICONHAND); free (msg); exit (2); } SDL_WM_SetCaption ("BIENVENDOS A INTERACTIVO COBAY", NULL);
done = 0; while (!done) { SDL_Event event;
/* Check for events */ while (SDL_PollEvent (&event)) { switch (event.type) { case SDL_KEYDOWN: break; case SDL_QUIT: done = 1; break; default: break; } }
/* Draw to screen */ draw (); }
return 0; }
|
|
|
3
|
Programación / Programación C/C++ / Codigo Fuente De menu [Abre el programa sin informacion]
|
en: 4 Marzo 2011, 22:43 pm
|
Hola amigos tengo un menu de entrada pero cuando lo compilo en DEV C++ aparece el cuadro de .exe sin nada osea no aparece la informacion que indique en el codigo no se que sea algo muy raro #include<stdio.h> #include<conio.h> #include<windows.h> #include"numeros romanos.h" //aqui estoy llamando a los otros codigos #include"magia.h"
main() {
int a; while(a!=0) { system( "cls");
printf ("ARCADE BRETALERA");
printf ( "----------" ); printf("----------"); printf("Elige un juego de la lista:"); printf("\n\n1- magia\n2- numeros romanos\n\n0- salir del programa"); printf("\n\nelige: "); scanf("%i",&a); switch (a) { case 1:magia();break; case 2:numerosromanos();break; default:
printf("pulsa cualquier tecla para salir"); getch(); } getch(); } getch(); return 0; } no encuentro error alguno y el compilador igual
|
|
|
4
|
Programación / Programación C/C++ / Necesito su ayuda amigos con un codigo
|
en: 16 Noviembre 2010, 01:49 am
|
Hola amigos pues estoy creando un programa que es el siguiente: Leer N edades, imprimir la edad que mas se registro, asi como el num de veces que esto sucedio. Necesito usar simplemente WHILE, IF Y ELSE mi codigo es el siguiente No esta funcionando correctamente y al asignarle el WHILE no lo respeta #include <stdio.h> #include <conio.h> #include <windows.h>
int edades,edad2,total_de_edades_registradas,edad; char desicion[2];
main()
{ edad=0; edades=0; edad2=0; total_de_edades_registradas=0;
printf("\n\n desea ingresar una edad"); gets(desicion); if (strcmp(desicion,"si")==0) { while(edades>=0) { printf("indique su edad: "); scanf("%d",&edad); edades++; printf("\n\n Terminar el ingreso de edades"); gets(desicion); if (strcmp(desicion,"si")==0) { printf("\n\n total de veces que funciono el programa %d",edades); } else { printf("indique su edad: "); scanf("%d", &edad); edades++; } } } getch(); return 0; }
|
|
|
|
|
|
|