Add files via upload

master
Can202 2021-03-25 16:14:06 -03:00 committed by GitHub
parent a1a6ec4380
commit 68f382cf09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 745 additions and 0 deletions

189
otros/Boleta.c Normal file
View File

@ -0,0 +1,189 @@
//Lo dela boleta
#include <stdio.h>
typedef struct{
int cantidad,codigo,precio,total;
}producto;
int main(){
int f1,f2,aux,continuar,descuento,descuento2,DW;
producto leche,pan,jugo,flan,yogurt,cereal,aceite,harina;
DW=1;
do{
f1=0;
continuar=0;
leche.codigo=1;
pan.codigo=2;
jugo.codigo=3;
flan.codigo=4;
yogurt.codigo=5;
cereal.codigo=6;
aceite.codigo=7;
harina.codigo=8;
leche.cantidad=0;
pan.cantidad=0;
jugo.cantidad=0;
flan.cantidad=0;
yogurt.cantidad=0;
cereal.cantidad=0;
aceite.cantidad=0;
harina.cantidad=0;
leche.precio=700;
pan.precio=1200;
jugo.precio=1000;
flan.precio=350;
yogurt.precio=1250;
cereal.precio=1220;
aceite.precio=1090;
harina.precio=520;
//Inicio de los datos
printf("La leche(1) cuesta 700, el kilo de pan(2) cuesta 1200, el jugo(3) cuesta 1000 y el flan(4) cuesta 350. \n");
printf("El yogurt(5) cuesta 1250, el cereal(6) cuesta 1220, el aceite(7) cuesta 1090 y la harina(8) cuesta 520. \n");
printf("Promocion: 2x1 en Leche.\n");
system("pause");
system("cls");
while(f1<1){
printf ("Inserte codigo: ");
fflush(stdin);
scanf ("%i",&aux);
switch (aux){
case 1:{
leche.cantidad++;
break;
}
case 2:{
pan.cantidad++;
break;
}
case 3:{
jugo.cantidad++;
break;
}
case 4:{
flan.cantidad++;
break;
}
case 5:{
yogurt.cantidad++;
break;
}
case 6:{
cereal.cantidad++;
break;
}
case 7:{
aceite.cantidad++;
break;
}
case 8:{
harina.cantidad++;
break;
}
default:{
printf ("El numero dado no existe. \n");
break;
}
}
printf("Dar otro codigo(1 si, 2 no): ");
scanf("%i",&continuar);
if(continuar==2){
f1++;
}else if (continuar>2){
printf("No diste 1 o 2.");
system ("pause");
}
system("cls");
}
//Descuento
int total;
descuento = leche.cantidad/2;
leche.total = leche.precio * leche.cantidad;
descuento2 = leche.precio * descuento;
leche.total = leche.total - descuento2;
pan.total = pan.precio * pan.cantidad;
jugo.total = jugo.precio * jugo.cantidad;
flan.total = flan.precio * flan.cantidad;
yogurt.total = yogurt.precio * yogurt.cantidad;
cereal.total = cereal.precio * cereal.cantidad;
aceite.total = aceite.precio * aceite.cantidad;
harina.total = harina.precio * harina.cantidad;
total = leche.total + pan.total;
total = total + jugo.total;
total = total + flan.total;
total = total + yogurt.total;
total = total + cereal.total;
total = total + aceite.total;
total = total + harina.total;
//Pago
int EFECTIVO,vuelto;
printf("(%i)\nCuanto paga? ",total);
scanf("%i",&EFECTIVO);
vuelto = EFECTIVO - total;
//Boleta
system("cls");
printf("Recuerda que hay descuento.\n");
Sleep(1000);
printf("Producto | Cantidad | Precio (Precio total) | Codigo.\n");
Sleep(1000);
if ( leche.cantidad > 0 ){
printf("Leche | %i | 700 (%i) | 1.\n",leche.cantidad,leche.total);
Sleep(1000);
}
if ( pan.cantidad > 0 ){
printf("Kilo de Pan | %i | 1200 (%i) | 2.\n",pan.cantidad,pan.total);
Sleep(1000);
}
if ( jugo.cantidad > 0 ){
printf("Jugo | %i | 1000 (%i) | 3.\n",jugo.cantidad,jugo.total);
Sleep(1000);
}
if ( flan.cantidad > 0 ){
printf("Flan | %i | 350 (%i) | 4.\n",flan.cantidad,flan.total);
Sleep(1000);
}
if ( yogurt.cantidad > 0 ){
printf("Yogurt | %i | 1250 (%i) | 5.\n",yogurt.cantidad,yogurt.total);
Sleep(1000);
}
if ( cereal.cantidad > 0 ){
printf("Cereal | %i | 1220 (%i) | 6.\n",cereal.cantidad,cereal.total);
Sleep(1000);
}
if ( aceite.cantidad > 0 ){
printf("Aceite | %i | 1090 (%i) | 7.\n",aceite.cantidad,aceite.total);
Sleep(1000);
}
if ( harina.cantidad > 0 ){
printf("Harina | %i | 520 (%i) | 8.\n",harina.cantidad,harina.total);
Sleep(1000);
}
printf("Descuento: %i. \n",descuento2);
Sleep(1000);
printf("Total: %i. \n",total);
Sleep(1000);
printf("Efectivo: %i. \n",EFECTIVO);
Sleep(1000);
printf("Vuelto: %i. \n",vuelto);
Sleep(1000);
system("pause");
system("cls");
printf("Cerrar(1) o no cerrar(otro numero): ");
scanf("%i",&DW);
system("cls");
}while(DW==1);
system("pause");
return 0;
}

BIN
otros/Boleta.exe Normal file

Binary file not shown.

19
otros/Ejercicio 1.c Normal file
View File

@ -0,0 +1,19 @@
//multiplos xD
#include <stdio.h>
int main (){
int n,aux,n2,a;
printf("Di un numero: ");
scanf("%i",&n);
n2 = n;
printf("Cuantos Multiplos: ");
scanf("%i",&a);
printf("%i, ",n);
for(aux = 1; aux < a; aux++){
n = n + n2;
printf("%i, ",n);
}
printf("etc. \n\n\n\n\n\n\n\n");
system("pause");
system("cls");
return 0;
}

BIN
otros/Ejercicio 1.exe Normal file

Binary file not shown.

View File

@ -0,0 +1,265 @@
//Tre en raya para 2 jugadores
#include <stdio.h>
#include <windows.h>
int main(){
char a1,a2,a3,a4,a5,a6,a7,a8,a9,X,O;
int b1,b2,b3,b4,b5,b6,b7,b8,b9,g;
g=0;
X='0';
O='0';
a1='1';
a2='2';
a3='3';
a4='4';
a5='5';
a6='6';
a7='7';
a8='8';
a9='9';
b1=0;
b2=0;
b3=0;
b4=0;
b5=0;
b6=0;
b7=0;
b8=0;
fflush(stdin);
b9=0;
system("pause");
system("cls");
while(g==0){
printf("|%c|%c|%c|\n",a1,a2,a3);
printf("|%c|%c|%c|\n",a4,a5,a6);
printf("|%c|%c|%c|\n",a7,a8,a9);
printf("Tu turno X: \n");
fflush(stdin);
scanf("%c",&X);
printf("Tu turno O: \n");
fflush(stdin);
scanf("%c",&O);
system("cls");
if(X==a1){
if(b1==0){
a1='x';
b1=1;
}
}
else if(X==a2){
if(b2==0){
a2='x';
b2=2;
}
}
else if(X==a3){
if(b3==0){
a3='x';
b3=2;
}
}
else if(X==a4){
if(b4==0){
a4='x';
b4=2;
}
}
else if(X==a5){
if(b5==0){
a5='x';
b5=2;
}
}
else if(X==a6){
if(b6==0){
a6='x';
b6=2;
}
}
else if(X==a7){
if(b7==0){
a7='x';
b7=2;
}
}
else if(X==a8){
if(b8==0){
a8='x';
b8=2;
}
}
else if(X==a9){
if(b9==0){
a9='x';
b9=2;
}
}
if(O==a1){
if(b1==0){
a1='o';
b1=1;
}
}
else if(O==a2){
if(b2==0){
a2='o';
b2=2;
}
}
else if(O==a3){
if(b3==0){
a3='o';
b3=2;
}
}
else if(O==a4){
if(b4==0){
a4='o';
b4=2;
}
}
else if(O==a5){
if(b5==0){
a5='o';
b5=2;
}
}
else if(O==a6){
if(b6==0){
a6='o';
b6=2;
}
}
else if(O==a7){
if(b7==0){
a7='o';
b7=2;
}
}
else if(O==a8){
if(b8==0){
a8='o';
b8=2;
}
}
else if(O==a9){
if(b9==0){
a9='o';
b9=2;
}
}
if(a1=='x'&&a2=='x'&&a3=='x'){
printf("Gano X.\n");
g=1;
printf("|%c|%c|%c|\n\r",a1,a2,a3);
printf("|%c|%c|%c|\n\r",a4,a5,a6);
printf("|%c|%c|%c|\n\r",a7,a8,a9);
}
else if(a3=='x'&&a6=='x'&&a9=='x'){
printf("Gano X.\n");
g=1;
printf("|%c|%c|%c|\n\r",a1,a2,a3);
printf("|%c|%c|%c|\n\r",a4,a5,a6);
printf("|%c|%c|%c|\n\r",a7,a8,a9);
}
else if(a7=='x'&&a8=='x'&&a9=='x'){
printf("Gano X.\n");
g=1;
printf("|%c|%c|%c|\n\r",a1,a2,a3);
printf("|%c|%c|%c|\n\r",a4,a5,a6);
printf("|%c|%c|%c|\n\r",a7,a8,a9);
}
else if(a1=='x'&&a4=='x'&&a7=='x'){
printf("Gano X.\n");
g=1;
printf("|%c|%c|%c|\n\r",a1,a2,a3);
printf("|%c|%c|%c|\n\r",a4,a5,a6);
printf("|%c|%c|%c|\n\r",a7,a8,a9);
}
else if(a1=='x'&&a5=='x'&&a9=='x'){
printf("Gano X.\n");
g=1;
printf("|%c|%c|%c|\n\r",a1,a2,a3);
printf("|%c|%c|%c|\n\r",a4,a5,a6);
printf("|%c|%c|%c|\n\r",a7,a8,a9);
}
else if(a3=='x'&&a5=='x'&&a7=='x'){
printf("Gano X.\n");
g=1;
printf("|%c|%c|%c|\n\r",a1,a2,a3);
printf("|%c|%c|%c|\n\r",a4,a5,a6);
printf("|%c|%c|%c|\n\r",a7,a8,a9);
}
else if(a2=='x'&&a5=='x'&&a8=='x'){
printf("Gano X.\n");
g=1;
printf("|%c|%c|%c|\n\r",a1,a2,a3);
printf("|%c|%c|%c|\n\r",a4,a5,a6);
printf("|%c|%c|%c|\n\r",a7,a8,a9);
}
else if(a4=='x'&&a5=='x'&&a6=='x'){
printf("Gano X.\n");
g=1;
printf("|%c|%c|%c|\n\r",a1,a2,a3);
printf("|%c|%c|%c|\n\r",a4,a5,a6);
printf("|%c|%c|%c|\n\r",a7,a8,a9);
}
else if(a1=='o'&&a2=='o'&&a3=='o'){
printf("Gano O.\n");
g=1;
printf("|%c|%c|%c|\n\r",a1,a2,a3);
printf("|%c|%c|%c|\n\r",a4,a5,a6);
printf("|%c|%c|%c|\n\r",a7,a8,a9);
}
else if(a3=='o'&&a6=='o'&&a9=='o'){
printf("Gano O.\n");
g=1;
printf("|%c|%c|%c|\n\r",a1,a2,a3);
printf("|%c|%c|%c|\n\r",a4,a5,a6);
printf("|%c|%c|%c|\n\r",a7,a8,a9);
}
else if(a7=='o'&&a8=='o'&&a9=='o'){
printf("Gano O.\n");
g=1;
printf("|%c|%c|%c|\n\r",a1,a2,a3);
printf("|%c|%c|%c|\n\r",a4,a5,a6);
printf("|%c|%c|%c|\n\r",a7,a8,a9);
}
else if(a1=='o'&&a4=='o'&&a7=='o'){
printf("Gano O.\n");
g=1;
printf("|%c|%c|%c|\n\r",a1,a2,a3);
printf("|%c|%c|%c|\n\r",a4,a5,a6);
printf("|%c|%c|%c|\n\r",a7,a8,a9);
}
else if(a1=='o'&&a5=='o'&&a9=='o'){
printf("Gano O.\n");
g=1;
printf("|%c|%c|%c|\n\r",a1,a2,a3);
printf("|%c|%c|%c|\n\r",a4,a5,a6);
printf("|%c|%c|%c|\n\r",a7,a8,a9);
}
else if(a2=='o'&&a5=='o'&&a8=='o'){
printf("Gano O.\n");
g=1;
printf("|%c|%c|%c|\n\r",a1,a2,a3);
printf("|%c|%c|%c|\n\r",a4,a5,a6);
printf("|%c|%c|%c|\n\r",a7,a8,a9);
}
else if(a4=='o'&&a5=='o'&&a6=='o'){
printf("Gano O.\n");
g=1;
printf("|%c|%c|%c|\n\r",a1,a2,a3);
printf("|%c|%c|%c|\n\r",a4,a5,a6);
printf("|%c|%c|%c|\n\r",a7,a8,a9);
}
else if(a1!='1' && a2!='2' && a3!='3' && a4!='4' && a5!='5' && a6!='6' && a7!='7' && a8!='8' && a9!='9'){
printf("Empate.\n");
g=1;
printf("|%c|%c|%c|\n\r",a1,a2,a3);
printf("|%c|%c|%c|\n\r",a4,a5,a6);
printf("|%c|%c|%c|\n\r",a7,a8,a9);
}
}
system ("pause");
return 0;
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,266 @@
/*SecretPlace v1.5*/
#include <stdio.h>
int loop(char v[10][20],int *AV);
void mod(char v[10][20],char *move,int *pX,int *pY,int *PV,int *j,int *g,int *AYUD,int *V);
void LS(int *l,int *k);
int probar(char v[10][20],int *V,int l,int k,int pY,int pX);
void uptade();
void draw(char v[10][20],int *V);
void intro(char v[10][20],int pY,int pX,int *V);
int main(){
char v[10][20];
int s,OV,N,g;
int AV;
OV=1;
N=0;
AV=3;
s=3;
printf("Eres nivel %i.\n",N);
system("pause");
system("cls");
do{
g=loop(v,&AV);
s=4;
system("cls");
if(g==3){
N++;
if(AV<100){
AV+=3;
}
printf("Eres nivel %i.\n",N);
}
else{
printf("Fuiste nivel %i, pero ahora ",N);
N=0;
AV=3;
printf("eres nivel %i.\n",N);
}
system("pause");
system("cls");
if(N==100){
printf("Felicidades llegaste al nivel 100, es el mejor nivel, presumelo, Empezaras de cero.");
N=0;
system("pause");
}
while(s==4){
system("cls");
printf("2 y despues intro para continuar.\n3 y despues intro para salir.\n");
fflush(stdin);
scanf("%i",&s);
if(s==2){
OV=2;
if(g!=3){
s=3;
}
}
else if(s==3){
OV=3;
}
else{
s=4;
}
system("cls");
}
}while(OV==2);
system("pause");
return 0;
}
int loop(char v[10][20],int *AV){
int g,pY,pX,j;
int PV,V;
int l,k;
int AYUD;
char move;
V=*AV;
g=0;
pY=7;
pX=9;
intro(v,pY,pX,&V);
LS(&l,&k);
do{
draw(v,&V);
PV=0;
move=getch();
mod(v,&move,&pX,&pY,&PV,&j,&g,&AYUD,&V);
if(AYUD==1){
g=probar(v,&V,l,k,pY,pX);
}
if(V<=0){
g=2;
}
}while(g==0);
draw(v,&V);
if(g==1){
printf("Abandonaste la partida.\n");
}
else if(g==2){
printf("Perdiste.\n");
}
else if(g==3){
printf("Ganaste.\n");
}
*AV=V;
system("pause");
return g;
}
void mod(char v[10][20],char *move,int *pX,int *pY,int *PV,int *j,int *g,int *AYUD,int *V){
int D;
if(*move=='a'||*move=='A'){
if(*pX>3){
v[*pY][*pX]=' ';
v[*pY][*pX+1]=' ';
*pX-=6;
*PV=1;
}
}
if(*move=='d'||*move=='D'){
if(*pX<15){
v[*pY][*pX]=' ';
v[*pY][*pX+1]=' ';
*pX+=6;
*PV=1;
}
}
else if(*move=='w'||*move=='W'){
if(*pX==9){
if(*pY>1){
v[*pY][*pX]=' ';
v[*pY][*pX+1]=' ';
v[*pY+1][*pX]=' ';
v[*pY+1][*pX+1]=' ';
*pY-=2;
*PV=1;
}
}
}
else if(*move=='s'||*move=='S'){
if(*pX==9){
if(*pY<7){
v[*pY][*pX]=' ';
v[*pY][*pX+1]=' ';
v[*pY+1][*pX]=' ';
v[*pY+1][*pX+1]=' ';
*pY+=2;
*PV=1;
}
}
}
for(D=9;D<=10;D++){
v[*pY+1][D]='-';
}
v[*pY][*pX]='c';
v[*pY][*pX+1]=':';
if(*PV==1){
*AYUD=1;
}
else{
*AYUD=0;
}
if(*move=='f'||*move=='F'){
*g=1;
}
uptade();
if(*V==0){
*g=2;
}
}
void LS(int *l,int *k){
srand(time(NULL));
int i;
i=rand()%7;
switch(i){
case 0:{
*l=1;
*k=3;
break;
}
case 1:{
*l=3;
*k=3;
break;
}
case 2:{
*l=5;
*k=3;
break;
}
case 3:{
*l=7;
*k=3;
break;
}
case 4:{
*l=1;
*k=15;
break;
}
case 5:{
*l=3;
*k=15;
break;
}
case 6:{
*l=5;
*k=15;
break;
}
case 7:{
*l=7;
*k=15;
break;
}
}
}
int probar(char v[10][20],int *V,int l,int k,int pY,int pX){
if(v[1][9]==' '&&v[3][9]==' '&&v[5][9]==' '&&v[7][9]==' '){
if(v[l][k]=='c'){
return 3;
}
else{
*V-=1;
}
}
return 0;
}
void uptade(){
system("cls");
}
void draw(char v[10][20],int *V){
int i,j;
for(i=0;i<10;i++){
for(j=0;j<20;j++){
printf("%c",v[i][j]);
}
printf("\n");
}
printf("VIDAS %i.\nControles:\nW para subir.\nS para bajar.\nA Izquierda.\nD Derecha.\nF Abandonar.\nInstrucciones:\nEncontrar el lugar secreto el\ncual es elegido al azar.\nPrueba tu suerte eligiedo 3 lugares\nporque cada vez que lleges a un\nlugar incorrecto perderas una vida.\nDe Manuel Gonzalez.\n",*V);
}
void intro(char v[10][20],int pY,int pX,int *V){
int i,j;
for(i=0;i<10;i++){
for(j=0;j<20;j++){
if(i==0||i==9){
v[i][j]='-';
}
else if(j==0||j==19){
v[i][j]='|';
}
else{
v[i][j]=' ';
}
}
}
for(j=9;j<=10;j++){
v[pY+1][j]='-';
}
for(i=8;i>=2;i-=2){
for(j=1;j<=5;j++){
v[i][j]='=';
}
for(j=14;j<=18;j++){
v[i][j]='=';
}
}
v[pY][pX]='c';
v[pY][pX+1]=':';
}

Binary file not shown.

6
otros/holamundo.c Normal file
View File

@ -0,0 +1,6 @@
#include <stdio.h>
int main(){
printf("Hola Mundo \n");
system("pause");
return 0;
}