Advertisement
kanciastopantalones

losowanie 999 liczb i ich suma

Mar 16th, 2011
187
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. #include <cstdio>
  3. #include <time.h>
  4. #include <stdlib.h>
  5. #include <conio.h>
  6. using namespace std;
  7. int tab[999];
  8. int main()
  9. {
  10. srand(time(0));
  11. int b=0;
  12. for(int i=1;i<=999;i++)
  13. {      
  14.                        tab[i]=rand()%7+4;
  15.                   cout << i << "." << tab[i] << "\t" ;
  16.                   b=b+tab[i];
  17.                  
  18.                   }
  19.  
  20. cout << endl << endl << "suma wszystkich wyrazow to: " << b;
  21.  
  22. getchar();
  23. cin.ignore();
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement