Autor
|
Tema: como puedo arreglar el error F:\collect2.exe[Error] ld returned 1 exit status (Leído 2,830 veces)
|
Alejandro2002
Desconectado
Mensajes: 3
|
hola, mi problema es que apenas estoy empezando a esto de la programación,pero mi profe ya me pidió meter arreglos a mi proyecto, solo que no puedo ni arreglar el error que me aparece, intento e intento pero no puedo arreglarlo, el error es F:\collect2.exe [Error] ld returned 1 exit status alguien me puede ayudar por favor? #include <stdio.h> #include <conio.h> int main () { int opc,opc1,opc2,cantidad; double acumsub=0, acumtotal=0,total,subtotal; printf("desea acceder al menu? \n "); printf("1.si \n"); printf("2.no \n"); scanf("%d",&opc); while(opc!=2) { printf(" OTAKO MARKET \n "); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n "); pirntf(" ~~~~~~~~~~~~~~~~~~~~~~~ \n "); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n "); printf("^ 1. Pokies 70.00 ^ \n "); printf("^ 2. Ramen 60.00 ^ \n "); printf("^ 3. Ramune 60.00 ^ \n "); printf("^ 4. Dangos 40.00 ^ \n "); printf("^ 5. Anpan 30.00 ^ \n "); printf("^ 6. Wagashi 30.00 ^ \n "); printf("^ 7. Onigiri 20.00 ^ \n "); printf("* INGRESE EL NUMERO DE PRODUCTO QUE DESEA* \n"); scanf("%d",&opc1); printf("cantidad para llevar \n "); scanf ("%d",&cantidad); if (opc1=1) { subtotal=cantidad*70.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==2) { subtotal=cantidad*60.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==3) { subtotal=cantidad*60.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==4) { subtotal=cantidad*40.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==5) { subtotal=cantidad*30.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==6) { subtotal=cantidad*30.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==7) { subtotal=cantidad*20.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else { printf("ERROR,la opcion no es valida \n "); } acumsub+=subtotal; acumtotal+=total; printf ("Desea realizar otra compra? \n "); printf ("1.si \n"); printf ("2.no \n"); scanf ("%d",&opc); } printf ("EL SUBTOTAL ES DE: %2.lf,acumsubtotal"); printf ("EL TOTAL A PAGAR ES DE: %2.lf",acumtotal); getch (); return 0; }
Mod: Obligatorio el uso dee etiquetas GeSHi.
|
|
« Última modificación: 15 Agosto 2018, 05:59 am por #!drvy »
|
En línea
|
|
|
|
CalgaryCorpus
|
No uses getch() ni conio.h
También fijate en las comillas en el penúltimo printf
|
|
|
En línea
|
|
|
|
Alejandro2002
Desconectado
Mensajes: 3
|
tengo que acabar este proyecto y lo tengo que entregar mañana a las 8 am, ya tiene ciclo while y if else,pero me falta hacerle arreglos,la vedad soy nuevo en esto y nose como meterle arreglos, si algun heroe que esta ahí que me ayude por favor,se lo agradeció con toda mi vida. por favor, lo necesito para mañana, por favor aqui esta mi proyecto #include <stdio.h> #include <conio.h> int main () { int opc,opc1,opc2,op3,op4,op5,op6,op7,cantidad; double acumsub=0, acumtotal=0,total,subtotal; printf("desea acceder al menu? \n "); printf("1.si \n"); printf("2.no \n"); scanf("%d",&opc); while(opc!=2) { printf(" OTAKO MARKET \n "); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n "); pirntf(" ~~~~~~~~~~~~~~~~~~~~~~~ \n "); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n "); printf("^ 1. Pokies 70.00 ^ \n "); printf("^ 2. Ramen 60.00 ^ \n "); printf("^ 3. Ramune 60.00 ^ \n "); printf("^ 4. Dangos 40.00 ^ \n "); printf("^ 5. Anpan 30.00 ^ \n "); printf("^ 6. Wagashi 30.00 ^ \n "); printf("^ 7. Onigiri 20.00 ^ \n "); printf("* INGRESE EL NUMERO DE PRODUCTO QUE DESEA* \n"); scanf("%d",&opc1); printf("cantidad para llevar \n "); scanf ("%d",&cantidad); if (opc1=1) { subtotal=cantidad*70.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==2) { subtotal=cantidad*60.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==3) { subtotal=cantidad*60.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==4) { subtotal=cantidad*40.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==5) { subtotal=cantidad*30.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==6) { subtotal=cantidad*30.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==7) { subtotal=cantidad*20.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else { printf("ERROR,la opcion no es valida \n "); } acumsub+=subtotal; acumtotal+=total; printf ("Desea realizar otra compra? \n "); printf ("1.si \n"); printf ("2.no \n"); scanf ("%d",&opc); } printf ("EL SUBTOTAL ES DE: %2.lf",acumsubtotal); printf ("EL TOTAL A PAGAR ES DE: %2.lf",acumtotal); getch (); return 0; }
Mod: Obligatorio el uso dee etiquetas GeSHi.
|
|
« Última modificación: 15 Agosto 2018, 06:00 am por #!drvy »
|
En línea
|
|
|
|
BloodSharp
Desconectado
Mensajes: 804
El Messi-Vegeta :D
|
tengo que acabar este proyecto(...)pero me falta hacerle arreglos, la vedad soy nuevo en esto y nose como meterle arreglos Aparte de los "arreglos" de tu código que no puede compilar, tenés los arreglos/vectores/arrays como prefieras llamarlos que son una secuencia seguida de variables del mismo tipo por ejemplo: int opc,opc1,opc2,op3,op4,op5,op6,op7,cantidad; Puede ser modificado a: int opc[8],cantidad; Y en ese código es realmente inútil quizás tener 8 variables del mismo tipo si solo utilizas una realmente, sería recomendable que nos escribas el enunciado para poder ayudarte mejor en el tema... Otro pequeño detalle: printf(" OTAKO MARKET \n "); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n "); pirntf(" ~~~~~~~~~~~~~~~~~~~~~~~ \n "); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n "); Cuidado ahí, sería recomendable que además de decir que tenés errores mostrarnos el resultado del compilador en donde los marca realmente además del código completo. Para finalizar sería mejor visualmente que escribas acá el código usando las etiquetas GeSHi para tener todo mejor visualizado B#
|
|
« Última modificación: 15 Agosto 2018, 04:21 am por BloodSharp »
|
En línea
|
|
|
|
Alejandro2002
Desconectado
Mensajes: 3
|
línea 14--while(opc!=2) ahi me sale :14 10 F:\OTAKO MARKET.c [Warning] comparison between pointer and integer
linea 28--scanf("%d",&opc1); ahi me sale 28 13 F:\OTAKO MARKET.c [Error] 'opc1' undeclared (first use in this function)
linea 115--printf ("EL SUBTOTAL ES DE: %2.lf \n",acumsubtotal); y ahi me sale: 115 39 F:\OTAKO MARKET.c [Error] 'acumsubtotal' undeclared (first use in this function) esos son los errores que me marca el compilador
|
|
« Última modificación: 15 Agosto 2018, 06:00 am por #!drvy »
|
En línea
|
|
|
|
BloodSharp
Desconectado
Mensajes: 804
El Messi-Vegeta :D
|
Código arreglado aún así no utiliza "arreglos", hasta que no escribas el enunciado no se podrá ver como ayudarte bien con ese tema... #include <stdio.h> #include <conio.h> int main () { int opc,opc1,opc2,op3,op4,op5,op6,op7,cantidad; double acumsub=0, acumtotal=0,total,subtotal; printf("desea acceder al menu? \n "); printf("1.si \n"); printf("2.no \n"); scanf("%d",&opc); while(opc!=2) { printf(" OTAKO MARKET \n "); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n "); printf(" ~~~~~~~~~~~~~~~~~~~~~~~ \n "); printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n "); printf("^ 1. Pokies 70.00 ^ \n "); printf("^ 2. Ramen 60.00 ^ \n "); printf("^ 3. Ramune 60.00 ^ \n "); printf("^ 4. Dangos 40.00 ^ \n "); printf("^ 5. Anpan 30.00 ^ \n "); printf("^ 6. Wagashi 30.00 ^ \n "); printf("^ 7. Onigiri 20.00 ^ \n "); printf("* INGRESE EL NUMERO DE PRODUCTO QUE DESEA* \n"); scanf("%d",&opc1); printf("cantidad para llevar \n "); scanf ("%d",&cantidad); if (opc1=1) { subtotal=cantidad*70.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==2) { subtotal=cantidad*60.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==3) { subtotal=cantidad*60.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==4) { subtotal=cantidad*40.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==5) { subtotal=cantidad*30.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==6) { subtotal=cantidad*30.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else if (opc1==7) { subtotal=cantidad*20.00; total=subtotal; printf("EL SUBTOTAL A PAGAR ES DE: %2.lf \n ",subtotal); printf("TOTAL A PAGAR: %2.lf \n ",total); } else { printf("ERROR,la opcion no es valida \n "); } acumsub+=subtotal; acumtotal+=total; printf ("Desea realizar otra compra? \n "); printf ("1.si \n"); printf ("2.no \n"); scanf ("%d",&opc); } printf ("EL SUBTOTAL ES DE: %2.lf",acumsub); printf ("EL TOTAL A PAGAR ES DE: %2.lf",acumtotal); getch (); return 0; }
B#
|
|
« Última modificación: 15 Agosto 2018, 05:03 am por BloodSharp »
|
En línea
|
|
|
|
|
Mensajes similares |
|
Asunto |
Iniciado por |
Respuestas |
Vistas |
Último mensaje |
|
|
FOR ATHEROS PCIE ETHERNET CONTROLLER me marca este eerror y no puedo iniciar
« 1 2 »
Windows
|
mijaary
|
11
|
33,467
|
10 Enero 2011, 22:57 pm
por Randomize
|
|
|
no entiendo los errores que me marca...
Programación C/C++
|
fer_fer_73
|
7
|
3,250
|
28 Febrero 2011, 04:06 am
por .:BlackCoder:.
|
|
|
porque no puedo realizar este ejercicio?, es por el compilador?
Programación C/C++
|
Belial & Grimoire
|
6
|
3,505
|
12 Mayo 2012, 04:49 am
por Belial & Grimoire
|
|
|
Errores que impiden el éxito de tu marca en Instagram
Noticias
|
wolfbcn
|
0
|
739
|
16 Noviembre 2018, 02:15 am
por wolfbcn
|
|
|
Necesito ayuda con mi código marca errores que no comprendo
Programación C/C++
|
Yaredsf
|
4
|
1,982
|
26 Noviembre 2018, 07:20 am
por AlbertoBSD
|
|