Advertisement
Guest User

Функции массивы 2

a guest
Dec 18th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int Zapros(int massiv[],int &b){
  5.     int a = 0;
  6.     while(10 > a)
  7.     {
  8.         cout << "Vvedite cacoeto chislo:";
  9.         cin >> massiv[a];
  10.         a++;
  11.     }
  12.     cout << "A teper vvedite nomer svoeu schkolu:";
  13.     cin >> b;
  14. }
  15. int Obrachunok(int &kolichestvo, int index,int masiv[]){
  16.     while (10 > kolichestvo)
  17.     {
  18.         if(masiv[kolichestvo] == index)
  19.         {
  20.             return 1;
  21.         }
  22.         kolichestvo++;
  23.     }
  24.     return 0;
  25. }
  26. int main()
  27. {
  28.     int index = 0,kolichestvo = 0;
  29.     int stat[10];
  30.     Zapros(stat,index);
  31.     Obrachunok(kolichestvo,index,stat);
  32.     if(kolichestvo == 1)
  33.     {
  34.         cout << "Ya znau etu sckolu!";
  35.     }else{
  36.         cout << "Ya ne snau etu scholu :(";
  37.     }
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement