Advertisement
Guest User

2019.10.15.

a guest
Oct 15th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int meret;
  8. cout<<"Mekkora legyen a tomb";
  9. cin>> meret;
  10. int t[meret];
  11. cout<<"Kerem a tomb elemeit";
  12. for(int i=0; i<meret;i++)
  13.         {cin>> t[i];}
  14.  
  15. int szam;int i=0;
  16.  cout<<"Melyik szamot keressem";
  17.    cin>>szam;
  18. int j=0;
  19. while (i<meret)
  20.  
  21.    {if (szam==t[i])
  22.             {cout<<i<<" ezen a helyen talaltam egy szamot ";
  23.  
  24.             j++;
  25.             }
  26.  
  27.  
  28.     i++;}
  29. cout<<j<<"db van belőle";
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement