All pastes #56944 Raw Edit

Anonymous

public text v1 · immutable
#56944 ·published 2006-05-18 21:00 UTC
rendered paste body
#include <stdio.h>
   #include <string.h>
   #include <stdlib.h>
   
   #define max 5
   void eisagwgi();
   void menu();
   void Provoli();
   void PoleisAn();
   void PoleisAf();
   void Times();
   void Theseiss();
   
   struct ptisi{
     char No[5];
     char PoliAn[15];
     char PoliAf[15];
     int Timi;
     int Theseis;
   }Ptiseis[max];
   
   
   main()
   {
   int epilogi;
   eisagwgi();
   system("cls");
   do{
   menu();
   printf("\n\nEpilogi :");
   scanf("%d", &epilogi);
   switch(epilogi)
   {
   case 1:Provoli();
   break;
   case 2:PoleisAn();
   break;
   case 3:PoleisAf();
   break;
   case 4:Times();
   break;
   case 5:Theseiss();
   break;
   case 6: exit(8);
   break;
   default:
  printf("Error, wrong number\n");
  system("pause");
   break;
   }
   }while(epilogi<1&&epilogi>6);
   }
   

   void menu(){
   int choice;
   system("cls");
   printf("\n1. Provoli\n2. Poleis Anax.\n3. Poleis Afix.\n4. Timi\n5. Theseis\n6. Exit");
   system("pause");
   }
   void Provoli(){
   int i;
   system("cls");
   for(i=0;i<max;i++)
   printf("Arithmos Ptisis: %s\nPoli Anaxwrisis: %s\nPoli Afiksis: %s\n\n",Ptiseis[i].No, Ptiseis[i].PoliAn, Ptiseis[i].PoliAf);
   system("pause");
   }

  void PoleisAn(){
  int i;
  system("cls");
  for(i=0;i<max;i++)
  printf("Poleis Anaxwrisis:\n%s",Ptiseis[i].PoliAn);
  system("pause");
  }

  void PoleisAf(){
  int i;
  system("cls");
  for(i=0;i<max;i++)
 printf("Poleis afiksis:\n%s",Ptiseis[i].PoliAf);
  system("pause");
  }
 void Times(){
 int i;
 system("cls");
  for(i=0;i<max;i++)
 printf("%.2s %.4d",Ptiseis[i].No, Ptiseis[i].Timi);
 system("pause");
 }
 void Theseiss(){
 int i;
 system("cls");
 for(i=0;i<max;i++);
 printf("%d, %.2s %2d",i+1, Ptiseis[i].No, Ptiseis[i].Theseis);
 system("pause");} 

void eisagwgi(){
strcat(Ptiseis[0].No, "OE154");
strcat(Ptiseis[1].No, "OE756");
strcat(Ptiseis[2].No, "OE515");
strcat(Ptiseis[3].No, "OE218");
strcat(Ptiseis[4].No, "OE584");
strcat(Ptiseis[0].PoliAn, "ATHINA");
strcat(Ptiseis[1].PoliAn, "THESSALONIKI"); 
strcat(Ptiseis[2].PoliAn, "ALEXANDROUPOLI");
strcat(Ptiseis[3].PoliAn, "HRAKLIO");
strcat(Ptiseis[4].PoliAn, "PATRA");
strcat(Ptiseis[0].PoliAf, "ROMI");
strcat(Ptiseis[1].PoliAf, "MANDRITI");
strcat(Ptiseis[2].PoliAf, "BARI");
strcat(Ptiseis[3].PoliAf, "OREGON");
strcat(Ptiseis[4].PoliAf, "TORONTO");
Ptiseis[0].Timi=154;
Ptiseis[1].Timi=145;
Ptiseis[2].Timi=168;
Ptiseis[3].Timi=256;
Ptiseis[4].Timi=287;
Ptiseis[0].Theseis=6;
Ptiseis[1].Theseis=7;
Ptiseis[2].Theseis=8;
Ptiseis[3].Theseis=9;
Ptiseis[4].Theseis=10;
}