fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a[10];
  6.  
  7.  
  8. for(int i=0; i<10; i++)
  9. {
  10. cout<<"Bitte ganze Zahl eingeben"<<endl;
  11. cin>> a[i];
  12. }
  13.  
  14. int anz = 0;
  15. for(int i = 0; i < 10; i++)
  16. {
  17. for(int ii = 0; ii < 10; ii++)
  18. {
  19. if(a[ii] == i)
  20. anz++;
  21. }
  22. if(anz > 0)
  23. cout << "Die Zahl " << i << " kommt " << anz << "x vor." << endl;
  24. anz = 0;
  25. }
  26. // your code goes here
  27. return 0;
  28. }
Success #stdin #stdout 0s 16064KB
stdin
5
5
6
7
5
9
4
2
2
7
stdout
Bitte ganze Zahl eingeben
Bitte ganze Zahl eingeben
Bitte ganze Zahl eingeben
Bitte ganze Zahl eingeben
Bitte ganze Zahl eingeben
Bitte ganze Zahl eingeben
Bitte ganze Zahl eingeben
Bitte ganze Zahl eingeben
Bitte ganze Zahl eingeben
Bitte ganze Zahl eingeben
Die Zahl 2 kommt 2x vor.
Die Zahl 4 kommt 1x vor.
Die Zahl 5 kommt 3x vor.
Die Zahl 6 kommt 1x vor.
Die Zahl 7 kommt 2x vor.
Die Zahl 9 kommt 1x vor.