why is my program stuck in the last while loop? compile this code.. then enter 3,4,5 for a,b,c and then enter "y'' for your choice to continue... it continues to loop forever
#include...
Type: Posts; User: xclarkiex5x
why is my program stuck in the last while loop? compile this code.. then enter 3,4,5 for a,b,c and then enter "y'' for your choice to continue... it continues to loop forever
#include...
so now onto the part with adding the numbers together.... i know i have to use infile >> variable... but how to order it from there confuses me...
ok yah programing is somewhat new to me so its gonna take me a while to get some of the things your trying to say
what would you suggest instead of infile.eof()?
hmm it gives me the correct amount of numbers in the file whenever i change the input file for the count program
youll be happy to know that i got the count program working without a hitch.. i used
(!infile.eof()) for the while statement. now just to modify that to make it work for the sum of numbers instead...
so ill need more variables maybe?
and have a sum somewhere.
ok and you were correct with your sum of the numbers instead of my count of the numbers
which means ill probably have to change the program
infile is a file stream so is outfile... i think
honestly i just saw something in my textbook that looked better than what i had.... im totally in the dark right now and just need somewhere to go.... i know that i want the while loop to say... ...
so what should the condition be
i can get my code to write to the file but it doesnt keep an accurate count.. i keep getting trash values such as: 536870912 Depending on what i have in the input file it changes but its always a...
umm im not really sure. i know i need to count the amount of numbers. so count++ in the while loop should be enough, im just really confused as to what condition i would use to make the while loop...
so how would i change it so that it only counts once.. also no matter how many numbers are in the file (say theres 42) i always get 1 as count.. how would i make the while condition work to count the...
changed a few things just now
//
//
//
//
#include <iostream.h>
#include <fstream.h>
#include <ios.h>
My program needs to do the following things
Asks the user of the name of the input file
If the user types an incorrect file name (a file name that does not exists in that directory), your code...
int c,cpl,pn,sd,vb;
cout << "\n1) Print the alphabet using a specified number of characters per line.";
cout << "\n2) Check to see if a number is prime.";
cout << "\n3) Get the sum of the...
i dont even know where to start.. i just need something to go from. i dont want my assignment done for me i just need a starting point
so i have a project for my class that has to have the user specify how many characters per line they want the alphabet to be displayed (1-26). thats where im lost. then the second part is that i have...
ok so ive been working on this project for about 3 days now and i still have a few problems. 1. capitals don't work. 2. i have no idea how to make remainder work because it wont work with double. 3....
i used hk_mp5kpdw's solution but now if i type the full word "add" instead of just "a" the program terminates.... and i also cant use this solution for the remainder because i cant used double. only...
stuck in mounds of if statements please help. i cant seem to figure out how to make the program get past my first if statement
#include <iostream>
using namespace std;
void main () {
double...
#include <iostream>
using namespace std;
void main () {
double x,y;
cout << "Give me a number: ";
cin >> x;
cout << "Give me another number: ";
cin >> y;
if (y==0)
cout << "Start...
program needs to be able to take 2 different numbers that part i know. then it has to output What do you want to do? i know i just use "cout <<" for that. the part of the project where i am confused...