Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - lockerss

#1
si ya vi donde estaba el error pero al final me sale esto


C:\Users\lockerss\Documents\juegos\collect2.exe   [Error] ld returned 1 exit status


noce que es

Código: c
#include <stdio.h>
#define V 21
#define H 75

void CAMPO (char CAMPO [V][H],int PELX, int PELY, int INIJUGA, int FINJUGA, int INIIA, int FINIA);
void BORDE (char CAMPO [V][H]);
void RAQJUGA (char CAMPO [V][H], int INIJUGA,int FINJUGA);
void RAQIA (char CAMPO [V][H], int INIIA,int FINIA);
void PEL(char CAMPO [V][H],int PELX,int PELY);

int main()
{


int PELX,PELY,INIJUGA,FINJUGA,INIIA,FINIA;

char CAMPO [V][H];

PELX=35;
PELY=11;

INIJUGA=8;
FINJUGA=12;

INIIA=8;
FINIA=12;

inicio(PELX,PELY,INIJUGA,FINJUGA,INIIA,FINIA);

system("pause");
return 0;
}

void CAMPO (char CAMPO [V][H],int PELX, int PELY, int INIJUGA, int FINJUGA, int INIIA, int FINIA)
{
BORDE (CAMPO);
RAQJUGA (CAMPO,INIJUGA,FINJUGA);
RAQIA (CAMPO,INIIA,FINIA);
PEL (CAMPO , PELX,PELY);

}

void BORDE (char CAMPO [V][H]){

int i,j;


for (i=0; i<V; i++){
for(j=0;j<H;j++){
if(i==0 || i==V-1){
CAMPO [i][j]='-';
}
else if (j==0 || j== H-1){
CAMPO [i][j]='|';
}
else{
CAMPO [i][j]=' ';
}

}
}
}


void RAQJUGA (char CAMPO [V][H], int INIJUGA,int FINJUGA){
int i,j;

for ( i= INIJUGA ; i<= FINJUGA; i++){
for (j=2;j=3; j++){


CAMPO[i][j]='8';
}
}
}

void RAQIA (char CAMPO [V][H], int INIIA,int FINIA){

int i,j;

for (i = INIIA; i<=FINIA; i++){
for (j=H -4;j = H-3; j++){

CAMPO[i][j]='8';
}
}

}



void PEL(char CAMPO [V][H],int PELX,int PELY){

CAMPO[PELX][PELY]='O';
}





ahi esta el codigo coregido y con el error que menciono que no se que es
#2
Hola quisiera pedirle ayuda con un problema de un corchete que no se que pasa empeze con un tutorial de youtube y ahora voy con un juego pero no se que tiene mal pongo el codigo para que me digan es en .c

Código: c
#include <stdio.h>
#define V 21
#define H 75


void CAMPO (char CAMPO [V][H],int PELX, int PELY, int INIJUGA, int FINJUGA, int INIIA, int FINIA);
void BORDE (char CAMPO [V][H]);
void RAQJUGA (char CAMPO [V][H], int INIJUGA,int FINJUGA);
void RAQIA (char CAMPO [V][H], int INIIA,int FINIA;
void PEL(char CAMPO [V][H],int PELX,int PELY);

int main()



{





int PELX,PELY,INIJUGA,FINJUGA,INIIA,FINIA;

char CAMPO [V][H];

PELX=35;
PELY=11;

INIJUGA=8;
FINJUGA=12;

INIIA=8;
FINIA=12;

inicio(PELX,PELY,INIJUGA,FINJUGA,INIIA,FINIA);

system("pause");
return 0;
}

void CAMPO (char CAMPO [V][H],int PELX, int PELY, int INIJUGA, int FINJUGA, int INIIA, int FINIA)
{
BORDE (CAMPO);
RAQJUGA (CAMPO,INIJUGA,FINJUGA);
RAQIA (CAMPO,INIIA,FINIA);
PEL (CAMPO , PELX,PELY);

}

void BORDE (char CAMPO [V][H]){

int i,j;


for (i=0; i<V; i++){
for(j=0;j<H;j++){
if(i==0 || i==v-1){
CAMPO [i][j]='-';
}
else if (j==0 || j== H-1){
CAMPO [i][j]='|';
}
else{
CAMPO [i][j]=' ';
}

}
}
}


void RAQJUGA (char CAMPO [V][H], int INIJUGA,int FINJUGA){
int i,j;

for ( i= INIJUGA ; i<= FINJUGA; i++){
for (j=2;j=3; j++){


CAMPO[i][j]='8';
}
}
}

void RAQIA (char CAMPO [V][H], int INIIA,int FINIA){

int i,j;

for (i = INIIA; i<=FINIA; i++){
for (j=H -4;=H-3; j++){

CAMPO[i][j]='8';
}
}

}



void PEL(char CAMPO [V][H],int PELX,int PELY){

CAMPO[PELX][PELY]='O';
}





no se que tiene mal :(  ya se que al compilar y ejecutar no aparecera nada porque no imprimo nada pero quiero saber porque ahi me da error
#3
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
Bueno probe el codigo en codeblock y con algunos cambios funciono

Código: c
#include<stdio.h>
#include<conio.h>

int main ()
{
float PRECIO, DESC;
char M[20]="con descuento";
char X[20];
//clrscr();
printf("Dar precio= ");
scanf("%f",&PRECIO);
strcpy (X , M );
if (PRECIO>100) {
  DESC = PRECIO * 0.1;
  PRECIO = PRECIO * 0.9;
}
printf("%8.2f", PRECIO);
printf("\n %f", DESC);
//gotoxy(1,22);
printf("Pusar una tecla");
getch();

return 0;
}


En si habia problemas de declaracion de variable como X[] a la cual no le dabas una longitud. Si no queres darle una capacidad predefinida declarala con punteros char * X;

Tambien a la variable precio la utilizabas en mayuscula y minuscula en diferente partes.
Para multiplicar utiliza el * no una "x"

A clrscr y gotoxy las puse como comentario porque no son indispensables en el funcionamiento del programa en si.
Ah en una parte queria imprimir el precio y le dabas dos formatos a la vez.




gracias la verdad esque soy nuevo y confundo los lenguajes xD apenas estoy empezando a estudiar gracias


UNA ULTIMA DUDA PORQUE CUANDO LE DOY BOUILD A CODEBLOCKS NO HACE NADA ?
#4
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
y los 8 errores con conio.h?
si pones conio.h te sigue tirando un error de libreria o ya no?

mira You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login


Citar
> mingw32-g++ -fshow-column -static-libstdc++ -static-libgcc -fshow-column -g "C:\Users\lockerss\zinjai\sin_titulo.cpp" -Wall -pedantic-errors -O0 -o "C:\Users\lockerss\zinjai\sin_titulo.exe"

C:\Users\lockerss\zinjai\sin_titulo.cpp:3:7: error: ISO C++ forbids declaration of 'main' with no type [-pedantic]
C:\Users\lockerss\zinjai\sin_titulo.cpp: In function 'int main()':
C:\Users\lockerss\zinjai\sin_titulo.cpp:7:9: error: storage size of 'X' isn't known
C:\Users\lockerss\zinjai\sin_titulo.cpp:8:9: error: 'clrscr' was not declared in this scope
C:\Users\lockerss\zinjai\sin_titulo.cpp:11:16: error: 'strcpy' was not declared in this scope
C:\Users\lockerss\zinjai\sin_titulo.cpp:12:6: error: 'precio' was not declared in this scope
C:\Users\lockerss\zinjai\sin_titulo.cpp:14:17: error: expected ';' before 'x'
C:\Users\lockerss\zinjai\sin_titulo.cpp:15:19: error: expected ';' before 'x'
C:\Users\lockerss\zinjai\sin_titulo.cpp:17:27: warning: format '%s' expects a matching 'char*' argument [-Wformat]
C:\Users\lockerss\zinjai\sin_titulo.cpp:19:13: error: 'gotoxy' was not declared in this scope

esos son los 8 errores con <conio.h> y con <coni.h> me sigue tirando solo 1 error
#5
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
Copia y pega los errores. Asi es mas facil.

Por casualidad tuviste error al copiar el codigo aqui o te falta cerrar la } del main?

tambien tengo duda de si clrser(); es en realidad clrscr(); ?
y strepy es strcpy...

Código: text
#include<stdio.h>
#include<coni.h>
main ()
{
float PRECIO, DESC;
char M[20]="con descuento";
char X[];
clrscr();
printf("Dar precio= ");
scanf("%f",&PRECIO);
strcpy (X , M );
if (precio>100)
{
DESC = PRECIO x 0.1;
precio = precio x 0.9;
}
printf("%8.2f %s", PRECIO);
printf("\n %f", DESC);
gotoxy(1,22); printf("Pusar una tecla");
getch();


}
  perdon no copie todo los errores son estos

Citar
> mingw32-g++ -fshow-column -static-libstdc++ -static-libgcc -fshow-column -g "C:\Users\lockerss\zinjai\sin_titulo.cpp" -Wall -pedantic-errors -O0 -o "C:\Users\lockerss\zinjai\sin_titulo.exe"

C:\Users\lockerss\zinjai\sin_titulo.cpp:2:17: fatal error: coni.h: No such file or directory
compilation terminated.
#6
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
fijate cambiando coni.h por conio.h

no ahora me tiro 8 errores si le pongo eso  :'(
#7
Hola soy nuevo en esto de programacion en c# apenas estoy empezando bueno todo normal pero me salio algo mal y noce que es

Código: c
#include<stdio.h>
#include<coni.h>
main ()
{
float PRECIO, DESC;
char M[20]="con descuento";
char X[];
clrser();
printf("Dar precio= ");
scanf("%f",&PRECIO);
strepy (X , M );
if (precio>100)
{
DESC = PRECIO x 0.1;
precio = precio x 0.9;
}
printf("%8.2f %s", PRECIO);
printf("\n %f", DESC);
gotoxy(1,22); printf("Pusar una tecla");
getch();


me dice que hay error en compilar por #include<coni.h> utilizo el zinja para compitar y tambien me sale el mismo error en turbo c

ayuda xD