php hit counter

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how we can store data into a file in C++ and java?
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#1
Having problem while storing this code inside the data file.
//includes
//some variables and strings not related to the problem:
float score = 0;
string Name; //User Name for File input;
string prev_score; //Previous User's Score;
ofstream user_score ("Score.txt");
ifstream prev_user("Score.txt");

//Structs, Functions and the main function, that contains calls to these functions.

//Deriving data from file:
while( prev_user.good() )
{
getline (prev_user, prev_score);
cout << prev_score << endl;
}
prev_user.close();

//Inputting Data to file:
user_score << "The previous player was: " << Name << endl;
user_score << Name << " scored " << score << " points.";
user_score.close();

//Termination.......
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Abstract data type (ADT) in C++ 2012 Vuhelper 0 7,145 01-04-2012, 10:34 PM
Last Post: Vuhelper
  call by value, call by reference,call by pointer in data structure 2012 Vuhelper 0 4,367 01-04-2012, 10:28 PM
Last Post: Vuhelper
  Balance of the AVL tree im Data structure 2012 Vuhelper 0 1,937 01-04-2012, 10:27 PM
Last Post: Vuhelper
  why we use queues data structure for level order traverse? Vuhelper 0 2,512 11-05-2011, 05:26 PM
Last Post: Vuhelper
  how to make .h file in c++ Vuhelper 0 3,655 11-05-2011, 05:20 PM
Last Post: Vuhelper
  Linklist Data Structure Vuhelper 0 1,939 11-05-2011, 05:11 PM
Last Post: Vuhelper
  In file included from C:/Dev-Cpp/include/c++/3.4.2/backward/iostream.h:31, from C:\Do sana.pari 2 3,633 11-02-2011, 03:02 AM
Last Post: baig66
  how can i read the last letter of a input file? 2011 Vuhelper 0 1,869 09-12-2011, 10:24 PM
Last Post: Vuhelper
  Boolean data problem in c++ 2011-12 Vuhelper 0 928 08-27-2011, 08:57 PM
Last Post: Vuhelper
  Overloaded >> operator not reading more than first line from data file in c++ 2011 Vuhelper 0 952 07-23-2011, 05:38 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support