Please help me!! I am new to C++
Here is a program helped me little bit.
--------------------------------------------------------------------------
#include <iostream>
#include <fstream>
using namespace std;
main () {
int filename;
cout << "Enter file name"; cin >> filename;
ofstream myfile;
myfile.open ("filename.txt");
myfile << "Writing this to a file.\n";
myfile << "000" << filename;
myfile.close();
return 0;
}
--------------------------------------------------------------------------
The above is only a sample, it does not work, Help to resolve this issue.
Let me explain how the program should?
1. I will enter a file name, then the program should add "000" three zeros before the filename, and should create a .txt file.
for example if I enter the file name as "1234567" (only digits), It should create "0001234567_OP.txt"
I can manage to put data on it.
Please help me any C++ experts, I am very new on this.