Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- int main(int argc, char* argv[])
- {
- int i,
- accountNumbers = 0;
- double numb,
- sum = 0;
- std::cout << "Enter number of sequence---->" <<std::endl;
- std::cin >> i;
- std::cout << "Enter numbers: " << std::endl;
- for (int j = 1; j <= i; j++)
- {
- std::string ending;
- switch (j)
- {
- case 1:
- ending = "st";
- break;
- case 2:
- ending = "nd";
- break;
- case 3:
- ending = "rd";
- break;
- default:
- ending = "th";
- }
- std::cout << "\n\rEnter " << j << ending << " number: " << std::endl;
- std::cin >> numb;
- std::cout << j << ending << " number is: " << numb << std::endl;
- sum += numb;
- accountNumbers++;
- }
- std::cout << "\n\rThere are " << accountNumbers << " numbers, which whole Sum is: "
- << sum << std::endl << std::endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement