| | |
help me...wher i did wrong?
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Nov 2007
Posts: 21
Reputation:
Solved Threads: 0
#include <iostream>
#include <fstream>
using namespace std;
int main( )
{
ifstream fin;
ofstream fout;
fin.open("income.dat");
if (fin.fail( ))
{
cout << "Input file opening failed.\n";
exit(1);
}
fout.open("total.dat");
if (fout.fail( ))
{
cout << "Output file opening failed.\n";
exit(1);
}
double next, sum = 0;
int count = 0;
while (fin >> next )
{
sum = sum + next;
count ++;
}
fin.close( );
fout.close( );
cout << "End of program.\n";
return 0;
}
i wan to make a program tat can read all the number in the file.....but it cant .... y?
#include <fstream>
using namespace std;
int main( )
{
ifstream fin;
ofstream fout;
fin.open("income.dat");
if (fin.fail( ))
{
cout << "Input file opening failed.\n";
exit(1);
}
fout.open("total.dat");
if (fout.fail( ))
{
cout << "Output file opening failed.\n";
exit(1);
}
double next, sum = 0;
int count = 0;
while (fin >> next )
{
sum = sum + next;
count ++;
}
fin.close( );
fout.close( );
cout << "End of program.\n";
return 0;
}
i wan to make a program tat can read all the number in the file.....but it cant .... y?
Last edited by ricnyx; Nov 26th, 2007 at 5:25 am.
![]() |
Similar Threads
- My CD-RW plays but won't burn. What could be wrong?? Help Please? (Storage)
- Retrieve email I sent to the wrong person (Web Browsers)
- Ram voltage wrong?? (Motherboards, CPUs and RAM)
- Am I going about this the wrong way (IT Professionals' Lounge)
- wats wrong with imesh??? (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: OpenGl, Visual c++ and textures
- Next Thread: Legal Bools
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node output parameter pointer problem program programming project proxy python read recursion recursive reference return rpg string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





