DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Calendario De Tareas Repetitivas

09.22.2006
| 4652 views |
  • submit to reddit
        Otro programa de calendario que muestra las tareas repetitivas semanalmente durante un tiempo determinado

#include <fstream>

using namespace std;

char nmeses[12][11]={ "Enero",
	 				"Febrero",
					"Marzo",
					"Abril",
					"Mayo",
					"Junio",
					"Julio",
					"Agosto",
					"Septiembre",
					"Octubre",
					"Noviembre",
					"Diciembre"};

char ndias[7][10]={ "Domingo",
	 				"Lunes",
	 				"Martes",
					 "Miercoles",
					 "Jueves",
					 "Viernes",
					 "Sabado",
					 };
					
int meses[12]={31,28,31,30,31,30,31,31,30,31,30,31};


int main(){
	int i,j,k,l;
	int cont=6;
	
	int clases[9][200][2];
	int contc[9]={0,0,0,0,0,0,0,0,0};
	int semana[9][4]={ {2,2,3,-1},
					   {2,2,4,-1},
					   {3,5,5,-1},
					   {3,5,5,-1},
					   {1,4,4,-1},
					   {4,4,5,-1},
					   {2,4,5,-1},
					   {1,1,3,3},
					   {1,1,3,3}};
	ofstream arc("clases.txt");
		
	for (i=0;i<12;i++){
		for (j=1;j<=meses[i];j++,cont++){			
			if (! ((i==0 && j>0 && j<24) || (i==2 && j>=21 && j<28))){
			for (k=0;k<9;k++){
				for (l=0;l<4 && semana[k][l]!=-1;l++){
					if (cont%7==semana[k][l]){
					   clases[k][contc[k]][0]=i;
					   clases[k][contc[k]][1]=j;
					   contc[k]++;	
		   			}
				}
			} 
			}
		}	
	}

	for (i=0;i<contc[4];i++){

			arc<<i+1<<",7A, "<<clases[4][i][1]<<"/"<<clases[4][i][0]+1<<"/2005"<<endl;
			arc<<i+1<<",7B, "<<clases[5][i][1]<<"/"<<clases[5][i][0]+1<<"/2005"<<endl;
			arc<<i+1<<",7C, "<<clases[6][i][1]<<"/"<<clases[6][i][0]+1<<"/2005"<<endl<<endl;									
	}
	arc.close();
	return 0;
}