Sachees

sponsorzy

Aug 10th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. struct donators
  4. {
  5. char surname[20];
  6. double donate;
  7. };
  8.  
  9. int main()
  10. {
  11. int NumberOfDonators;
  12. std::cout << "Witaj w programie naszego towarzystwa! Podaj liczbe wplacajacych:\n";
  13. std::cin >> NumberOfDonators;
  14. std::cout << "Wspaniale! Bedziemy teraz prosic o podawanie kolejnych wplacajacych!\n";
  15. donators * GreatOnes = new donators [NumberOfDonators];
  16. for(int i = 0; i < NumberOfDonators; i++)
  17. {
  18. std::cout << "Prosze podac imie i nazwisko wplacajacego nr " << i+1 << ":\n";
  19. std::cin.ignore();
  20. std::cin.getline(GreatOnes[i].surname, 20);
  21. std::cout << "Prosze teraz podac ilosc, jaka wplacila ta osoba:\n";
  22. std::cin >> GreatOnes[i].donate;
  23. }
  24. std::cout << "NASI WSPANIALI SPONSORZY!\n";
  25. int j = 0;
  26. for(int i = 0; i < NumberOfDonators; i++)
  27. {
  28. if(GreatOnes[i].donate >= 10000)
  29. {
  30. j++;
  31. std::cout << GreatOnes[i].surname << "\n";
  32. }
  33. }
  34. if(j == 0)
  35. std::cout << "Brak.\n";
  36. std::cout << "NASI SPONSORZY:\n";
  37. int k = 0;
  38. for(int i = 0; i < NumberOfDonators; i++)
  39. {
  40. if(GreatOnes[i].donate < 10000)
  41. {
  42. std::cout << GreatOnes[i].surname << "\n";
  43. k++;
  44. }
  45.  
  46. }
  47. if(k == 0)
  48. std::cout << "Brak.\n";
  49. delete [] GreatOnes;
  50. return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment