(\n)
Type: Posts; User: dispatch4599
(\n)
I was trying to count the number of integers read AND the number of times looped because I only want the first two lines. I am at work right now but will try all suggestions when I get home.
I'm not getting the answer that it should be. The output should be 266.888. The output I am receiving is 193.333. There are NO compiler errors. There are 4 lines of integers and I only want to...
Again, I am stuck! (last part of my program, thank god) I need to read just two lines of my file of integers. I thought the following code would work, however, I am once again wrong and at a loss. ...
Ahh, got ya. Thank you all for your help with that. Sorry to be such a nuisance. This is all new to me and I am trying very hard to understand everything. Sometimes it is difficult for me to...
When I checked my output it equaled the amount I got from using the calculator. Hell, at this point, I'm just happy to have it do that..
Ok here is what worked and it is in the professor guidelines..
sum = 0;
under = true;
while (under)
LOL. I just looked at the assignment sheet and it says to use a flag controlled loop structure.. So much for that... lol. I can't wait till we get more freedom with our coding... <sigh>
Probably because it's not been taught yet to use it, although I don't know for sure. Vart helped me the other night and he saw the <break> in the program and said that I needed to do it again. ...
DUDE relax. I can't change it when I'm at work. When I get home this evening it will be done.
I also apologize that my professor has rules for us. I'm not a brick wall, I do listen and each...
Not allowed to use breaks.
Tried to get rid of it but the program would just stop and not continue... so it works the way it is, thats the way Im going to leave it for now. LOL
This is how the professor requested it. ...
and yes I see that I forgot to read from file...
I think that I need to take a break from this stuff at night... ughhhhhh
I am soooo confused... Ok, Im going to post the whole program..... maybe this will clear things up..
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cmath>
using...
I'm absolutely sure. This is part 7 of the program with me using the infile for all of the solutions.
Actually, I'm not adding the same number to sum over and over. It pulls in the next number from the file. I know that the answer is going to be something I could kick myself for as that has been...
inFile.open ("K:\\DATFILE1.TXT");
if ( !inFile )
{
cout<< "**Can't open input file**" <<endl;
return 1;
}
sum = 0;
under = true;
Here is just the while loop. The object is to add the integers in the file until the sum < = 1000.
sum = 0;
under = true;
while (inFile && under)
We were required to use float. You guys are the greatest. I changed just a few things to get it to look like what I have actually learned but nonetheless, thank you so much. Now I get to move on to...
you are correct. I apologize. Now can someone explain to me what the float num, sum=0.f means.. mainly the 0.f? I have never seen this used before.
I think his code is correct, it states greater than or equal to 13 to stop running.
ok maybe I'm just too tired.. <sigh>
Whoa... that is way beyond what I have been instructed so far. I'm just a beginner here. LOL. There is alot here I don't know the meaning to. Take it back to wayyyy basic. I would like to...
Riddle me this... when I manually put my first 12 integers into a calculator I get an average of 340.083. Even when I use your code, I get an average of 313.923. Ughh.. this is going to be the...
Sorry, I'm not more knowledgeable on this stuff like the end of file stuff. Right now I don't use that and just insert the file name to read just from the file.
while (liscense)
{
...
As a newbie myself, I would check and make sure that your file path is correct. I've used the wrong file path a million times. For example is your text file on ("F:\\regfile.txt")?
Try adding...