Wednesday, 29 May 2013

How to make a folder using c++


This is the source code of making folder using c++:
 in this code i use my "D" to save the new folder i make. You can store this new folder in any drive you want by giving the address in parentheses. 

#include<iostream.h>
#include<conio.h>
#include<direct.h>

 main()
{
 
       mkdir("D:/myfolder");
       return 0;
}
End

how to delete a folder using c++


How to delete a folder in c++:-
This is the source code that how to delete a folder in a computer using c++


#include <errno.h>
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
    using namespace std;
  
    int main()
    {                                         
    rmdir("D:/myfolder");          //myfolder is the name of the folder
    return 0;
    }
End

how to shut down your computer using c++




This is very interesting program.when you compile and run this program it will ask you that "do you want to shut down your computer?".so this is an interesting application of c++.


#include <stdio.h>
#include <stdlib.h>

main()
{
   char ch;

   printf("Do you want to shutdown your computer now (y/n)\n");
   scanf("%c",&ch);

   if (ch == 'y' || ch == 'Y')
      system("C:\\WINDOWS\\System32\\shutdown -s");

   return 0;
}
End