Skip to content
Permalink
e7e8a75a86
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
65 lines (58 sloc) 2.1 KB
// CreateTeam.cpp
// BasketBallGame
//
// Created by Suraj Mann on 02/03/2020.
// Copyright © 2020 Suraj Mann. All rights reserved.
//
#include "CreateTeam.h"
#include <iostream>
using namespace std;
//Calling create team class - Suraj
CreateTeam::CreateTeam()
{
}
//Calling Create players function - Suraj
void CreateTeam::create_players()
{
// communicating user input
int number_of_players = 5;
cout << "" << endl;
cout << "" << endl;
cout << "You now to create 5 different players for your team, allocating attributes for each player" << endl;
cout << "Each attribute value of 1 equals the use of £10 in currency" << endl;
// for loop for creating players, updating currency and storing in a vector
int currency = 10000;
for(int i=0; i<number_of_players; i++)
{
string player;
cout << "Currency remaining: " << currency << endl;
cout << "" << endl;
int a=0;
while(a<1)
{
cout << "Please name your player: "; cin >> player;
cout << "" << endl;
players_list.push_back(player);
int shooting, dribbling, guarding, stamina, acceleration, height;
cout << "Please enter your player attributes choosing a number between 0-99" << endl;
cout << "Shooting: "; cin >> shooting;
cout << "Dribbling: "; cin >> dribbling;
cout << "Guarding: "; cin >> guarding;
cout << "Stamina: "; cin >> stamina;
cout << "Acceleration: "; cin >> acceleration;
cout << "Height (cm): "; cin >> height;
cout << "" << endl;
int new_currency = (shooting*10) + (dribbling*10) + (guarding*10) + (stamina*10) + (acceleration * 10);
if(new_currency > currency)
{
cout << "You do not have enough money left for this allocation, please try again" << endl;
cout << "Please try again" << endl;
}
else
{
currency = currency - new_currency;
a=1;
}
}
}
}