Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- /////////////////////////////////////////////////////
- int main()
- {
- int n = 14;
- if(n == 1) printf("Jan \n");
- if(n == 4) printf("April \n");
- if(n < 0 || n > 12) printf("Error ! \n");
- }
- /*
- #include <stdio.h>
- /////////////////////////////////////////////////////
- int main()
- {
- int n = 14;
- if(n == 1) printf("Jan \n");
- if(n == 4) printf("April \n");
- if(n < 0) printf("Error ! \n");
- if(n > 12) printf("Error ! \n");
- }
- */
- /*
- #include <stdio.h>
- /////////////////////////////////////////////////////
- int main()
- {
- int n = 1;
- switch(n)
- {
- case 1: printf("Jan\n");
- break;
- case 4: printf("April\n");
- break;
- default: printf("Error!\n");
- }
- }
- */
- /*
- #include <stdio.h>
- #include <iostream>
- using namespace std;
- #include <stdlib.h>
- int f_Max(int *p);
- int f_Min(int *p);
- /////////////////////////////////////////////////////
- int main()
- {
- int n[20];
- for(int i = 0; i < 20; i ++)
- {
- n[i] = rand() %100;
- cout<<n[i]<<", ";
- }
- std::cout << std::endl;
- int nRes = f_Max(&n[0]);
- cout << "nRes = " << nRes << endl;
- printf("index of min = %d\n", f_Min(n));
- return 0;
- }
- ////////////////////////////////////////////////////
- int f_Min(int *p)
- {
- int n1 = *p,
- n2 = 0;
- // printf("n = %d\n", n1);
- for(int i = 1; i < 20; i ++)
- {
- if(n1 > p[i])
- {
- n1 = p[i];
- n2 = i ;
- }
- }
- return n2;
- }
- ////////////////////////////////////////////////////
- int f_Max(int *p)
- {
- int n1 = *p,
- n2 = 0;
- // printf("n = %d\n", n1);
- for(int i = 1; i < 20; i ++)
- {
- if(n1 < p[i])
- {
- n1 = p[i];
- n2 = i ;
- }
- }
- return n2;
- }
- */
- // = {100, 1, 2, 3, 4, 5, 6, 7};
- /*#include <stdio.h>
- int nArr[99] = { 0,1,2,3,4,5,6, 73,8,9,10 };
- void foo(int *p)
- {
- printf("%d\n", *p);
- }
- int main()
- {
- for (int i = 0; i <10; i++)
- {
- foo(&nArr[7]);
- }
- printf(" - - - - - - \n");
- int &a = nArr[7],
- n2,
- &a2 = nArr[3];
- printf(" a2 = %d\n", a2 );
- printf("nArr[7] = %d\n", nArr[7]);
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement