Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
Multiplayer Lobby Simulator
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Allen B. Doelue
Multiplayer Lobby Simulator
Commits
ea5b5f7e
Commit
ea5b5f7e
authored
May 07, 2020
by
Allen B. Doelue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Opens the PlayersLists.txt file and uses the data to create player objects
parent
6ff87add
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
main.cpp
main.cpp
+35
-0
No files found.
main.cpp
0 → 100644
View file @
ea5b5f7e
#include <iostream>
using
namespace
std
;
#include "Player.h"
#include <fstream>
#include <sstream>
int
main
()
{
//open file and read lines
ifstream
myfile
(
"PlayersList.txt"
);
if
(
myfile
.
is_open
())
{
while
(
!
myfile
.
eof
())
//while not at end of file
{
string
username
;
string
rankStr
;
unsigned
rank
;
//store player data into strings
getline
(
myfile
,
username
,
'-'
);
getline
(
myfile
,
rankStr
,
'\n'
);
//convert rank string to int
stringstream
conversion
(
rankStr
);
conversion
>>
rank
;
//create player object
Player
p
(
username
,
rank
);
p
.
displayName
();
cout
<<
p
.
getRank
()
<<
endl
;
//enqueue and repeat with next player
}
}
else
cout
<<
"file cannot open"
;
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment