Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,210 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,296 people online right now. Registration is fast and FREE... Join Now!




a new function

 
Reply to this topicStart new topic

a new function, please ppl i need ur help urgentlyyyy

quaresma
20 May, 2008 - 11:15 PM
Post #1

New D.I.C Head
*

Joined: 5 May, 2008
Posts: 19

plz i want a function of three parameters
Example : void check (string filename , string playername , int score)

the first parameter for the name of the file to save in
second for the player's name
and third for his score

this function should check if the playername sent to it existed before in the file it should update his score
if the name doesnt exist it should append his name and score in the file

thats all
i need it urgently as there is no time and this is the only thing missing in my code

thnxxx
User is offlineProfile CardPM
+Quote Post

joske
RE: A New Function
20 May, 2008 - 11:39 PM
Post #2

D.I.C Head
**

Joined: 4 Sep, 2007
Posts: 158



Thanked: 12 times
My Contributions
So, what you have to do is:
  • check (or decide) how the name and score are (or will be) stored in the file
  • open the file, and read it record by record
  • compare the read name with the players name that you are looking for. If found you have to change the score.
  • if not found after reading the whole file, you have to add a new record with the name and score

User is offlineProfile CardPM
+Quote Post

mikeblas
RE: A New Function
21 May, 2008 - 05:31 AM
Post #3

D.I.C Head
**

Joined: 8 Feb, 2008
Posts: 155



Thanked: 1 times
My Contributions
An important first step in reaching the goals that joske points out is deciding on a format for your file.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/4/08 01:08PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month