how to save the file in the new created directer

hi, I have on code, but I don't know how to improve it. To make the result.txt in the newly created directer ?

The code are following :

#include<iostream>
#include<stdlib.h>
#include<ctime>
#include<time.h>
#include<fstream>
#include<stdlib.h>
#include<stdio.h>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<sys/stat.h>
using namespace std;




int main()
{

int n;
cout<<"paramater for p and N: ";
cin>>n;


char folder[101];
cout<<"name your folder no fo: ";
cin>>folder;

char path[]="//Users//rw36//Desktop//new";

strcat(path, folder);
mkdir(path,0777);
cin.get();

ofstream ou("result.txt" , ios::out);

for ( int i=0; i<10; i++)
{
ou<<i*10<<endl;
}

return 0;
}
Hi ! Use code tags pls :)
U'r using a ton of includes when only 2 or 3 of them should be enough...

Change this: char path[]="//Users//rw36//Desktop//new";
to this: char path[]="C://Users//rw36//Desktop//new";

Topic archived. No new replies allowed.