Hi,
This is my first post here and I am in need with some help(might need a lot) with a lesson my professor has given me to help me understand loops.
Here is an imgur link to my current homework. http://i.imgur.com/9Mcja.jpg
As you can see on there I have them listed on which ones are supposed to be sentinel and which ones are supposed to be count control loops.
This is currently what I have:
This class has me stumped currently and I am having a hard time breezing through the class at my instructors speed. So I don't want to get too far behind.Code:#include <iostream> #include <cmath> #include <iomanip> #include <fstream> using namespace std; void main() { int count = 0; int sum = 0; int num; ofstream fileout; ifstream filein; filein.open("C:\\Users\\commiedic\\Desktop\\New folder\\datafile2.txt"); fileout.open("C:\\Users\\commiedic\\Desktop\\New folder\\answers.txt"); sum=0; filein>>num; filein.get(inchar); while(filein) { sum=sum+num;} }
Right now this program is giving me an error that opens CMD and gives me infinite lines of "0's".




Reply With Quote