Loading...
DimovIvan 16 Точки

## Programming Basics Online Exam - 28 and 29 March 2020, задача: 06. Tournament of Christmas

Имам проблем когато името на спорта ми е повече от една дума. Използвам getline(cin, nameGame), но ми дава time limit на всички тестове.

Предположих, че е защото преди getline използвам само cin. Пробвах с cin.clear(), но пак не се получава. Може би не го поставям където трябва.

int main()
{
int days, counterWinner = 0;
cin >> days;
double moneyTournament = 0;
for (int i = 0; i < days; i++)
{
double moneyDay = 0;
string nameGame;

//cin.clear();

//getline(cin, nameGame);
cin >> nameGame;
int counterWins = 0, counterLoses = 0;
while (nameGame != "Finish")
{
string result;
cin >> result;
if (result == "win")
{
moneyDay += 20;
counterWins++;
}
else if (result == "lose")
{
counterLoses++;
}

//cin.clear();

//getline(cin, nameGame);
cin >> nameGame;
}
if (counterWins > counterLoses)
{
moneyDay *= 1.1;
counterWinner++;
}
moneyTournament += moneyDay;
}
if (counterWinner > days / 2)
{
moneyTournament *= 1.2;

cout << fixed << setprecision(2) <<"You won the tournament! Total raised money: " << moneyTournament << endl;
}
else
{
cout << fixed << setprecision(2) << "You lost the tournament! Total raised money: " << moneyTournament << endl;
}
return 0;
}

Това ми е кода и работи коректно при спортове с едно име. Помогнете ми как да го направя с getline

Тагове:
0
nartonurki -1 Точки

Chatiw Alternatives: The thinking of modern people is gradually changing and they also prefer modern tools and devices to carry out their works.

Jay Cutler Instagram: Jason Isaac Cutler is known as Jay Cutler is an American IFBB Professional Bodybuilder and he has earned that name and fame by working hard.

How to Stay Safe and Secure Online: More than 4.5 billion people use the internet worldwide, which is more than half the world’s population.

What Is Not Working Capital?: Net Working Capital (NWC) is the characteristic of a company’s current assets and current liabilities.

What Is The Profit Formula?: Profit Formula While people often use the terms benefit and revenue synonymously, they are quite different concepts in business.

Smith And Wesson Stock: Smith And Wesson Stock: Throughout most of its history, the company formerly known as Smith & Wesson Holdings was best known for its guns.

Trash Compactor: A compactor is a machine or mechanism used to reduce the size of material such as waste material or bio mass through compaction.

Starfox Marvel: Starfox Like many of you, I am a big fan of both Nintendo-developed video games, and the recent decade of the connected universe Marvel superhero movies.

Blackboard FCPS: Online blackboard teaching is a new trend followed by universities. The United States first introduces online teaching.

Appvalley VIP: Among those millions of apps that are made for iPhone devices, one app that has made a different place for itself is AppValley.

-1
nartonurki -1 Точки

HealthyFalcon: Expert's Tips · Avocado Chicken Salad Recipe · Best Exercises for stronger and broader chest · Access Online Yoga for Specific Goals

HealthstopWatch - Sports Gadgets from a great selection at Sports, Fitness & Outdoors Store.

Health Tutor Tips: On the occasion of Teacher's Day, here are our top tips for all teachers to keep going and remain strong, healthy and happy.

Healthy Mom Kids: Want a better way to cut down on the number of sick days your child takes? Find out how mom-pediatricians keep their own families healthy ...

Health Zone Tips: Eat organic food, consume plenty of fruits and vegetables, drink plenty of water, sleep 8 hours a day, always avoid processed food, avoid sugary stuff, etc.

AllTechPride: Water soluble vitamins and electrolytes from Alltech. For use when animals and poultry are under stress, convenient to use as a water or feed additive.

TrueinTech: TrueTech Technology Magazine is an online publication featuring the latest technology, design, and lifestyle news, gadget reviews, and full-fledged gadget .

Tech Edesign: The designers of eDesign come from a wide array of electronic design backgrounds and were trained in Japan, Taiwan, as well as in-house. Moreover .

Tech Eglobal: EGlobalTech Integrates Cyber, Technology, and Business to Reach Innovative Solutions. Learn about EGT contract vehicles, EGTLabs emerging technology .

Techforgen: Installing LocaliAPStore on IOS 10.3.3 & Above – A Complete Guide 2020 · Leave a Comment. This article is all about what LocaliAPStore is and how to install .

UtMe Class: Mastering English for JAMB UTME and post UTME examinations for candidates in Yenagoa, Bayelsa State. I'm a medical doctor with A1 in SSCE English

Generac Spec Writer: From intelligent BIM files to helpful tools that enhance and expedite the design, sizing and spec writing process for today's consulting and specifying engineers,

Write Essay Service: Essay Writing Service Without Freelance Writers from India, Africa and etc. Custom Work, 24/7 Support, 30-Day Free Revision, Min.Deadline 6 Hour.

Custom My Paper: Additionally, we check each custom paper for plagiarism to make sure it's original and has references that are properly cited. Super essay writers.

Order My Essay: Need an essay writer who is native English speaking? When you say "Write my essay for me!" our essay ... PLACE ORDER REQUEST QUOTE. We do it all.

-1
romaa -1 Точки

Не ми приема cin.ignor() функциятя. Вкарал съм библиотеките #include <ios> и #include <limits>, но пак не става.

Изписва ми следната грешка:bazoocam

Error    C2039    'ignor': is not a member of 'std::basic_istream<char,std::char_traits<char>>'

Да не би да ми трябва друга   библиотека?

-1
kabirsii 0 Точки

Не признавам работата на cin.ignor (). Имам интегрирани библиотеки #include <ios> и #include <limits>, но не работи.

Получавам свързана грешка: bazoocam

Гаф C2039 „игнориране“: не „полово предавани omegle tv болести :: basic_istream <char, полово предавани болести :: char_traits <char>>“

Имам ли нужда от друга ometv библиотека?

-1
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.