| | |
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 application array arrays based beginner binary c++ c/c++ calculator char 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 givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib library linkedlist linker list loop looping loops map math matrix memory newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg simple sorting string strings studio temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





