This is now the official thread for intermediate C++ students to help each other.
Dreaper, do you know why this doesn't work, the != doesn't make a difference.
EDIT: It works now.Code://Chris Taylor //February 22, 2006 //Terminal 6, Intermediate Computer Prgramming. //Switch Program //These are my header files. #include <conio.h> #include <fstream.h> #include <iomanip.h> #include <iostream.h> //This is the start of my program. int main() { //prints to the text file. ofstream outfile ("500.txt"); //Declaring my variables. int cd=5; //number that starts the countdown. int r1; //number that is stored from division of 5. int r2; //number that is stored from modulus of r1. int r3; //number that is stored from division of 7. int r4; //number that is stored from modulus of r3. while (cd<500) { r1=cd/5; r2=r1%5; r3=cd/7; r4=r3%7; if (r2==0||r4==0) cout << cd << ", "; cd++; } //That stuff at the end. getch(); return 0; }
Code:int main() { ofstream outfile ("PN.txt"); int cd=5; //number that starts the countdown. int r1; //number that is stored from modulus of r1. int r2; //number that is stored from modulus of r3. while (cd<500) { r1=cd%5; r2=cd%7; if (r1==0||r2==0) cout << cd << ", "; cd++; } getch(); return 0; }



Reply With Quote