Guest User

Untitled

a guest
Jul 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <ctime>
  4.  
  5.  
  6. using namespace std;
  7. int main()
  8. {
  9. tryAgain:
  10. srand(time(NULL));
  11. setlocale(LC_ALL, "ru");
  12. bool alreadyThere;
  13. int randNumber, quantity, selection;
  14. int fourNull = 0000;
  15.  
  16.  
  17.  
  18. cout << "Выберите тип генерации" << endl
  19. << "1.Упорядоченный" << endl
  20. << "2.Рандомный" << endl;
  21. cin >> selection;
  22.  
  23. switch (selection)
  24. {
  25. case 1:
  26. cout << "Выберите количество генерируемых номеров" << endl;
  27. cin >> quantity;
  28. alreadyThere = false;
  29. while (fourNull <= quantity)
  30. {
  31. fourNull++;
  32. cout << "+7910000" << setw(4) << setfill('0') << fourNull << "tt";
  33.  
  34. }
  35. goto tryAgain;
  36. break;
  37.  
  38. case 2:
  39. cout << "Выберите количество генерируемых номеров" << endl;
  40. cin >> quantity;
  41. for (int i = 0; i <= quantity; i++)
  42. {
  43.  
  44.  
  45.  
  46. randNumber = rand() %9999 + fourNull;
  47. cout << "+7910000" << setw(4) << setfill('0') << randNumber << "tt";
  48.  
  49.  
  50.  
  51. }
  52. goto tryAgain;
  53. break;
  54.  
  55. default:
  56. goto tryAgain;
  57. break;
  58.  
  59. }
  60. system("pause");
  61. return 0;
  62. }
Add Comment
Please, Sign In to add comment