knugi

Untitled

May 18th, 2015
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. void petlaFor(int c){
  5. cout << "Petla For, czas:"<<c<<"\n";
  6.  
  7. }
  8. void petlaWhile(int c){
  9. cout << "Petla While, czas:"<<c<<"\n";
  10.  
  11. }
  12. void petlaDoWhile(int c){
  13. cout << "Petla DoWhile, czas:"<<c<<"\n";
  14. }
  15.  
  16. int main(){
  17. cout << "Czeœæ, jestem tutaj, aby wyœwietliæ tobie Randomow¹ osobê z tablicy.\n";
  18. cout << "[1] For\n";
  19. cout << "[2] While\n";
  20. cout << "[3] Do.. While\n";
  21. int wybor;
  22. while(true){
  23. cin >> wybor;
  24. if(wybor<1||wybor>3)
  25. cout << "Niepoprawny wybor !\n";
  26. else break;
  27. }
  28. cout << "Wybor poprawny.. Teraz podaj czas\n";
  29. int czas;
  30. cin << czas;
  31. if(czas!=0){
  32. cin<<czas;
  33. }
  34. switch(wybor){
  35. case 1:
  36. petlaFor(czas);
  37. break;
  38. case 2:
  39. petlaWhile(czas);
  40. break;
  41. case 3:
  42. petlaDoWhile(czas);
  43. break;
  44. default:
  45. main();
  46. break;
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment