Facebook
From Cute Treeshrew, 9 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 780
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int n;
  5. int main()
  6. {
  7.         string napis;
  8.         cin >> napis;
  9.         cout << napis[0] << endl;
  10.         cout << napis[napis.length()-1]<< endl;
  11.        
  12.         system("pause");
  13. }
  14.  
  15. #include<iostream>
  16. #include<cstdlib>
  17. using namespace std;
  18. int n,a;
  19. int main()
  20. {
  21.         char napis[11];
  22.         for (int i=0;i<10;i++)
  23.         cin >> napis[i];
  24.         cout << napis[5]<< endl;
  25.         system("pause");
  26. }
  27.  
  28. #include<iostream>
  29. #include<cstdlib>
  30. #include<time.h>
  31.         using namespace std;
  32.         int tab[50];
  33.         void losuj()
  34.         {
  35.             srand(time(NULL));
  36.             for (int i=0;i<50;i++)
  37.             {tab[i]=rand()%201;}
  38.         }
  39.         void policz()
  40.         {
  41.                 int ilosc=0;
  42.                 for (int i=0;i<50;i++)
  43.                 { if((tab[i]>=100) && (tab[i]<=150))ilosc++;}
  44.                 cout << "Ilosc: " << ilosc << endl;
  45.                 }
  46.                 int main()
  47.                 {
  48.                         losuj();
  49.             policz();
  50.             for (int i=0;i<50;i++)cout<<tab[i]<<endl;
  51.                         system("pause");
  52.         }
  53.  
  54. #include<iostream>
  55. #include<cstdlib>
  56. #include <time.h>
  57. using namespace std;
  58. int tab[30];
  59. int ludzik(int a)
  60. {
  61.         int i;
  62.         for (i=0;i<2;i++)
  63.         {
  64.                 cin>> tab[i];
  65.         }
  66. }
  67. int los(int a)
  68. {
  69.         int i;
  70.         for (i=2;i<10;i++)
  71.         {
  72.                 tab[i]= rand()%1000+1;
  73.         }
  74. }
  75. int main()
  76. {
  77.         int a,i;
  78.         srand(time(NULL));
  79.         cout << "Podaj 2 liczby: " << endl;
  80.         ludzik(a);
  81.         los(a);
  82.         for (i=0;i<10;i++)
  83.         {
  84.         cout << "ZAwartosc numer: "  << i+1 << ": " << tab[i] << endl;
  85. }
  86. }
  87.  
  88. #include<iostream>
  89. #include<cstdlib>
  90. using namespace std;
  91. int tab[20];
  92. int sprawdz(int a)
  93. {
  94.     if (a%2==0)return 1;
  95.     else return 0;
  96. }
  97. int main()
  98. {
  99.     int parzyste=0;
  100.     for (int i=0;i<20;i++)
  101.     {
  102.         cin>>tab[i];
  103.         parzyste+=sprawdz(tab[i]);
  104.     }
  105.     cout << "Wprowdzono "<< parzyste << " liczb parzystych"<<endl;
  106.     system ("pause");
  107. }
  108.  
  109.