Estimados;
dada mi total ignorancia para programar en C, acudo a algun voluntario, para que el c贸digo siguiente lo pueda incluir en un .prg
Como veran es una funci贸n que calcula el CUIL/CUIT (al menso en Argentina).
Como ver谩n tiene dos campos que me interesar铆a pasar desde un Dialog. Uno ser铆a un Combo y el otro un get numerico
De manera que para mi ser铆a de utilidad la llamada a la funci贸n C con el paso de estos 2 par谩metros
Desde ya muchas gracias
dada mi total ignorancia para programar en C, acudo a algun voluntario, para que el c贸digo siguiente lo pueda incluir en un .prg
Como veran es una funci贸n que calcula el CUIL/CUIT (al menso en Argentina).
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
void algoritmo (int documento[8], int opcion, int &xy, int &z){
聽 聽 int aux=0, i=0;
聽 聽if(opcion==1){
聽 聽聽aux=2*5+0*4;
聽 聽}
聽 聽if(opcion==2){
聽 聽聽aux=2*5+7*4;
聽 聽}
聽 聽if(opcion==3){
聽 聽聽aux=3*5+0*4;
聽 聽}
聽 聽for(i=0;i<8;i++){
聽 聽聽if(i==0){
聽 聽 聽 聽 aux+=documento[i]*3;
聽 聽 聽 }
聽 聽 聽 if(i==1){
聽 聽 聽 聽 aux+=documento[i]*2;
聽 聽 聽 }
聽 聽 聽 if(i==2){
聽 聽 聽 聽 aux+=documento[i]*7;
聽 聽 聽 }
聽 聽 聽 if(i==3){
聽 聽 聽 聽 aux+=documento[i]*6;
聽 聽 聽 }
聽 聽 聽 if(i==4){
聽 聽 聽 聽 aux+=documento[i]*5;
聽 聽 聽 }
聽 聽 聽 if(i==5){
聽 聽 聽 聽 aux+=documento[i]*4;
聽 聽 聽 }
聽 聽 聽 if(i==6){
聽 聽 聽 聽 aux+=documento[i]*3;
聽 聽 聽 }
聽 聽 聽 if(i==7){
聽 聽 聽 聽 aux+=documento[i]*2;
聽 聽 聽 }
聽 聽}
聽 聽if(aux%11==0){
聽 聽聽z=0;
聽 聽 聽 if(opcion==1){
聽 聽聽聽 聽 xy=20;
聽 聽聽}
聽 聽聽if(opcion==2){
聽 聽聽聽 聽 xy=27;
聽 聽聽}
聽 聽聽if(opcion==3){
聽 聽聽聽 聽 xy=30;
聽 聽聽}
聽 聽}
聽 聽if(aux%11==1){
聽 聽聽if(opcion==1){
聽 聽 聽 聽 xy=23;
聽 聽 聽 聽 聽z=9;
聽 聽 聽 }
聽 聽 聽 if(opcion==2){
聽 聽 聽 聽 xy=23;
聽 聽 聽 聽 聽z=4;
聽 聽 聽 }
聽 聽}
聽 聽if((aux%11!=1)&&(aux%11!=0)){
聽 聽聽z=11-aux%11;
聽 聽 聽 if(opcion==1){
聽 聽聽聽 聽 xy=20;
聽 聽聽}
聽 聽聽if(opcion==2){
聽 聽聽聽 聽 xy=27;
聽 聽聽}
聽 聽聽if(opcion==3){
聽 聽聽聽 聽 xy=30;
聽 聽聽}
聽 聽}
}
main(){
int documento[8], z=0, xy=0, opcion=0, i=0;
char aux1, aux2[8];
printf("== Algoritmo para obtener CUIL / CUIT ==\n\n");
printf("\t Seleccione Tipo (Persona Fisica o Juridica):\n");
printf("\n\t 1 - Hombre");
printf("\n\t 2 - Mujer");
printf("\n\t 3 - Sociedad (Empresa)\n\t ");
aux1=getch();
opcion=atoi(&aux1);
printf("\n\t Ingrese numero de documento (sin puntos): ");
for(i=0;i<8;i++){
聽 聽 documento[i]=0;
聽 聽 aux2[i]=getch();
聽 聽documento[i]=atoi(&aux2[i]);
聽 聽printf("%d",documento[i]);
}
algoritmo(documento,opcion,xy,z);
printf("\n\n\t Su numero de CUIL / CUIT es: ");
printf("%d - ",xy);
for(i=0;i<8;i++){
聽 聽printf("%d",documento[i]);
}
printf(" - %d",z);
printf("\n\n\t Creado por Nahuel Sanchez (<!-- m --><a class="postlink" href="http://www.leegar.com.ar">http://www.leegar.com.ar</a><!-- m -->).\n\t Presione una tecla para salir.");
getch();
}Como ver谩n tiene dos campos que me interesar铆a pasar desde un Dialog. Uno ser铆a un Combo y el otro un get numerico
De manera que para mi ser铆a de utilidad la llamada a la funci贸n C con el paso de estos 2 par谩metros
Desde ya muchas gracias
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
Chaco - Argentina