With the code provided in your post, you can do what you have done without the fstream. Here let me revise it for you.Code:#include <iostream.h> #include <stdio.h> /*void*/ int main() //do not use void. Read the FAQ on why { int Amt; //total numbers to loop int i=0; //starting point char str[50]; //an array { cout<<"Welcome to the math program.\n"; cout<<"How may numbers do you want to use?"; cin>>Amt; //user input for loop count } while(i<Amt) { i++; cout<<"adding 1 to "<<i<<endl; } }