| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Visual C++ Programming Ask questions about Windows programming with Visual C++ and help others by answering their questions. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
help please because it due by wed
{proj7.txt}
12 5 39 27 9 190 29 46 23 8 19 97 20 i need help Developing a C++ program to: 1.read a series of integer numbers from the file proj7.txt 2.calculate and display the total of these numbers 3.calculate and display the average of these numbers what i have so far is number 1 but i need help completing 2-3 #include<iostream> #include<fstream> #include<ctime> using namespace std; int main() { int total; const int text=81; char input[text]; fstream dataFile; dataFile.open("proj7.txt",ios::in ); if (!dataFile) { cout<<"Error"<<endl; return 0; } dataFile.getline(input,text,'$'); while(!dataFile.eof()) { cout<<input<<endl; dataFile.getline(input,text,'$'); } cout<<total<<endl; dataFile.close(); return 0; } |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|