Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int nMonth = 3;
- ////////////////////////////////////////////////////////
- int main() //
- {
- switch(nMonth)
- {
- case 1: printf("January\n");
- break;
- case 5: printf("May\n");
- break;
- case 12: printf("December\n");
- break;
- default: printf("Error !\n");
- }
- }
- /*
- */
- // printf("%c\n", 'a');
- ////////////////////////////////////////////
- /*
- #include <cstdio>
- #include <cstdlib>
- #include <ctime>
- void minimum(int *p);
- void maximum(int * );
- ///////////////////////////////// //printf("%d\n", time(0) );
- int main() //
- {
- srand(time(0));
- int array[20] = {22, 1, 276, 81, 77, 9, 12};
- int i = 0;
- for (; i < 20; i++)
- {
- array[i] = rand()%200;
- }
- i = 0;
- for(; i < 20;i++) printf("%d\n", array[i] );
- printf("\n- - - - - -\n\n");
- minimum(&array[0]);
- maximum(&array[0]);
- return 0;
- }
- /////////////////////////////////////////
- void maximum(int *p) //
- {
- int nMax = p[0],
- nIndex = 0;
- for(int i = 1; i < 20;i++)
- {
- if(nMax < p[i])
- {
- nMax = p[i];
- nIndex = i ;
- }
- }
- printf("Index = %d, Maximum = %d\n", nIndex, nMax);
- }
- /////////////////////////////////////////
- void minimum(int *p) //
- {
- int nMin = p[0],
- nIndex = 0 ;
- for(int i = 1; i < 20;i++)
- {
- if(nMin > p[i])
- {
- nMin = p[i];
- nIndex = i ;
- }
- }
- printf("Index = %d, nMin = %d\n", nIndex, nMin);
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement