Showing posts with label compiler. Show all posts
Showing posts with label compiler. Show all posts

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

Saturday, 13 October 2012

how to find the prime number using c++(with simple coding)


how to find prime number in c++
how to find prime number in c++:
This is the source code for determining that given number is prime or not
#include<iostream.h>
#include<conio.h>
main()
{
      int x;
      for(int i=1;i<=100;i++){
      cout<<"enter the number"<<endl;
      cin>>x;
      if(x==2 || x==3 || x==5){
             cout<<"number is prime"<<endl;
             }
      else if(x%2==0 || x%3==0 || x%5==0)
      {
                cout<<"not prime"<<endl;
                }
                else
                {
                    cout<<"number is prime"<<endl;
                    }
                     
                       }
                    getch();
                    }
End