Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- void monitor(int* p);
- /////////////////////////////////////////////////////////////////
- int main() //
- {
- srand(time(0));
- int v = 7,
- nCounter = 0;
- int array[10];
- for(int i = 0; i < 10; i++)
- {
- array[i] = rand()%200;
- }
- monitor(array);
- v = array[9];
- printf("The last element in the array = %d \n", v);
- for(int i = 0; i < 9; i++)
- {
- if (array[i] < v)
- {
- nCounter ++;
- }
- }
- printf("The number of elements is less than the last one = %d \n", nCounter);
- }
- /////////////////////////////////////////////////////////////////
- void monitor(int* p) //
- {
- for (int i = 0; i < 10; i++)
- {
- printf("%d ,", p[i]);
- } printf("\n");
- }
- /*
- #include <stdio.h>
- #include<locale.h>
- char * foo(int p);
- //////////////////////////////////////////////////////////////////////
- int main()
- {
- setlocale(LC_ALL, "rus");
- int n = 4;
- char *psz = foo(n);
- printf("%s\n", psz);
- }
- //////////////////////////////////////////////////////////////////////
- char *foo( int p)
- {
- static char array1[10] = "Один";
- static char array2[10] = "Два";
- static char array3[10] = "Три";
- static char array4[10] = "Четыре";
- static char array5[10] = "ПЯть";
- static char array6[10] = "Шесть";
- static char array7[10] = "Семь";
- static char array8[10] = "Восемь";
- static char array9[10] = "Девять";
- if(p == 1) return array1;
- if(p == 2) return array2;
- if(p == 3) return array3;
- if (p == 4)
- {
- return array4;
- }
- if (p == 5)
- {
- return array5;
- }
- if (p == 6)
- {
- return array6;
- }
- if (p == 7)
- {
- return array7;
- }
- if (p == 8)
- {
- return array8;
- }
- if (p == 9)
- {
- return array9;
- }
- if (p > 9)
- {
- printf("%s", "Не существует цифар");
- }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement