Skip to content

Commit

Permalink
v1.0.21 Codename: CataHache
Browse files Browse the repository at this point in the history
  • Loading branch information
Caidev committed Jul 8, 2020
1 parent cbab8df commit 1de4edd
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion CuadraticApp_C/src/CuadraticApp.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

int main(void) {
system("title [#CuadraticApp v1.0.2] - [Codename: CataHache]");
system("color F5");
system("color FD");
system("mode con: cols=65 lines=30");
cuatraticApp();
return EXIT_SUCCESS;
Expand Down
18 changes: 9 additions & 9 deletions CuadraticApp_C/src/MainApp/MainApp.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "MainApp.h"

int inputNumbers(int* ax2, int* bx, int* c){
int sucess = 0;
int success = 0;
int A;
int B;
int C;
Expand All @@ -50,13 +50,13 @@ int inputNumbers(int* ax2, int* bx, int* c){
*ax2 = A;
*bx = B;
*c = C;
sucess = 1;
success = 1;
}
return sucess;
return success;
}

int calculateDeterminant(int* ax2, int* bx, int*c, double* determinant){
int sucess = 0;
int success = 0;
int aAux = *ax2;
int bAux = *bx;
int cAux = *c;
Expand All @@ -65,19 +65,19 @@ int calculateDeterminant(int* ax2, int* bx, int*c, double* determinant){
determinantAux = ((bAux*bAux)-(4*aAux*cAux));
if(determinantAux>=0){
*determinant = sqrt(determinantAux);
sucess = 1;
success = 1;
}else{
printf(" _______________________________________\n");
printf(" [Message]: El determinante es negativo,\n"
" con lo cual no es posible hallar una\n"
" raiz cuadrada de un negativo,\n"
" por lo tanto posee raices imaginarias!.\n");
}
return sucess;
return success;
}

int cuatraticApp(){
int sucess = 0;
int success = 0;
int ax2;
int bx;
int c;
Expand Down Expand Up @@ -108,7 +108,7 @@ int cuatraticApp(){
printf(" _______________________________________\n");
printf(" [ACLARACION]: el puntito es una coma!_\n");
printf(" sus raices son [%.2f] y [%.2f] .\n",root1,root2);
sucess = 1;
success = 1;
}
}
break;
Expand All @@ -119,5 +119,5 @@ int cuatraticApp(){
system("pause");
system("cls");
}while(answer=='y');
return sucess;
return success;
}
48 changes: 24 additions & 24 deletions CuadraticApp_C/src/Validate/caidevValidate.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

// MEJORA DEL FGETS
int myGets(char *string, int longitud) {
int retorno=-1;
int success=-1;
char bufferString[4096];

if (string != NULL && longitud > 0) {
Expand All @@ -41,11 +41,11 @@ int myGets(char *string, int longitud) {
}
if(strnlen(bufferString,sizeof(bufferString)) <= longitud){
strncpy(string, bufferString, longitud);
retorno=0;
success=0;
}
}
}
return retorno;
return success;
}

//PARA VALIDAR ENTEROS
Expand All @@ -56,20 +56,20 @@ int myGets(char *string, int longitud) {
* \return Retorna 1 (vardadero) si la cadena es numerica y 0 (falso) si no lo es
*/
int isNumber(char *string, int limite) {
int retorno = 1;
int success = 1;
int i;
for (i = 0; i < limite && string[i] != '\0'; i++) {
if (i == 0 && (string[i] == '+' || string[i] == '-')) {
continue;
}
if (string[i] > '9' || string[i] < '0') {
retorno = 0;
success = 0;
break;
}
//CONTINUE
}
//BREAK
return retorno;
return success;
}

/**
Expand All @@ -78,41 +78,41 @@ int isNumber(char *string, int limite) {
* \return Retorna 0 (EXITO) si se obtiene un numero entero y -1 (ERROR) si no
*/
static int getInt(int* pResultado){
int retorno=-1;
int success=-1;
char bufferString[50];
if( pResultado != NULL &&
getString(bufferString,sizeof(bufferString)) == 0 &&
isNumber(bufferString, sizeof(bufferString))) {
retorno=0;
success=0;
*pResultado = atoi(bufferString) ;

}
return retorno;
return success;
}

int utn_getNumero(int* pResultado, char* mensaje, char* mensajeError, int minimo, int maximo, int reintentos){
int retorno = 0;
int success = 0;
int bufferInt;
do{
printf("%s",mensaje);
if( getInt(&bufferInt) == 0 &&
bufferInt >= minimo && bufferInt <= maximo){
retorno = 1;
success = 1;
*pResultado = bufferInt;
break;
}
printf("%s",mensajeError);
reintentos--;
}while(reintentos>=0);

return retorno;
return success;
}

// PARA VALIDAR FLOTANTES

int esFlotante(char *string) {
int i=0;
int retorno = 1;
int success = 1;
int contadorPuntos=0;

if (string != NULL && strlen(string) > 0) {
Expand All @@ -125,51 +125,51 @@ int esFlotante(char *string) {
contadorPuntos++;
}
else{
retorno = 0;
success = 0;
break;
}
}
}
}
return retorno;
return success;
}

static int getFloat(float* pResultado){
int retorno=-1;
int success=-1;
char buffer[64];

if(pResultado != NULL){
if(getString(buffer,sizeof(buffer))==0 && esFlotante(buffer)){
*pResultado = atof(buffer);
retorno = 0;
success = 0;
}
}
return retorno;
return success;
}

int utn_getNumeroFlotante(float* pResultado, char* mensaje, char* mensajeError,
float minimo, float maximo, int reintentos){
float bufferFloat;
int retorno = 0;
int success = 0;
while(reintentos>=0){
reintentos--;
printf("%s",mensaje);
if(getFloat(&bufferFloat) == 0){
if(bufferFloat >= minimo && bufferFloat <= maximo){
*pResultado = bufferFloat;
retorno = 1;
success = 1;
break;
}
}
printf("%s",mensajeError);
}
return retorno;
return success;
}

// PARA VALIDAR CADENAS

int getString(char *string, int longitud) {
int retorno=-1;
int success=-1;
char bufferString[4096];

if (string != NULL && longitud > 0) {
Expand All @@ -181,10 +181,10 @@ int getString(char *string, int longitud) {
}
if(strnlen(bufferString,sizeof(bufferString)) <= longitud){
strncpy(string, bufferString, longitud);
retorno=0;
success=0;
}
}
}
return retorno;
return success;
}

0 comments on commit 1de4edd

Please sign in to comment.