Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Deck::salvar_deck(string filename)
- {
- ofstream file;
- string linha;
- vector<int> quantidade(26,0);
- cout << "\nDeck: " << _deck << endl << endl;
- cout << "\nVector das quantidades antes:\n";
- for (size_t i = 0; i < quantidade.size(); i++)
- cout << quantidade[i] << endl;
- for (size_t i = 0; i < _deck.size(); i++)
- {
- if (_deck[i] == '_')
- ++quantidade[26];
- else
- ++quantidade[_deck[i] - 'A'];
- }
- cout << "\n\nVector das quantidades depois:\n";
- for (size_t i = 0; i < quantidade.size(); i++)
- cout << quantidade[i] << endl;
- // Pausa
- cin.get();
- file.open (filename.c_str());
- for (int g = 0; g < 27 ; ++g) {
- linha = "";
- if (g != 27) {
- file << "\n" << char ('A' + g) << " "
- << quantidade['A' + g] << " " << scores[g];
- } else {
- file << "\n" << "_" << " " << quantidade[26]
- << " " << scores[27];
- }
- file.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement