Skip to main content

The MultiMatics - A C++ Project

/*This program is a very basic one, but still a quite long use, making it useful for learning*/
/* I HAVE WRITTEN THIS BY MYSELF, and I give FULL RIGHTS TO ANYONE willing to take this code for learning purpose, or for experimenting with this! And, 'please' don't use this for "copy&paste" purposes*/

#include<iostream>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
#define 1/0 Not_Defined
using namespace std;
void delay(void)
{
    for(int i=0;i<3000;i++)
    for(int j=0;j<9090;j++) {}
}
void expan(void);
long double fact(long int a);
//long double pow(long int x,long int y) has been removed by me due to no need
void pac();
void trigo(void);
void genac();
int main()
{
    float a,b; long int x,n,p,choice;
    punarvichaar:
    clrscr();
    cout<<"Enter : "<<endl<<"@ 1 for expansion of (1+x)^n"<<endl
<<"\n@ 2 for factorial calculation"<<"@ 3 for power calculation"<<endl<<"@ 4 Permutations and Combinations"<<endl
    <<"@ 5 for Trigonometric calculations"<<"\n@ 6 for General Arithmetic Calculations and others"<<"\n@ 7 To exit"<<"\n\n";
    cin>>choice;
    switch(choice)
    {
        case 1:       clrscr(); expan();
                      break;
    case 2:     clrscr();
                    cout<<"\n\nEnter the number : "<<"\n";
                    cin>>a;
                    cout<<endl<<fact(a)<<endl;
                 break;
    case 3:     clrscr();
                cout<<"\n\nEnter number and power:";
                cout<<"\nNumber : ";     cin>>a;
                cout<<"\nPower : " ;     cin>>b;
                cout<<"\n\n"<<a<<" to the power "<<b<<" is "<<"\n"<<pow(a,b); break;
    case 4: clrscr();
            pac();
            break;
    case 5: clrscr();
            trigo();
            break;
    case 6: clrscr();
            genac();
            break;
    default:   cout<<endl<<"Kripya phir se prayas kare...@-@"<<endl;
                delay(); goto punarvichaar;
       break;    }
    getch();
}
void expan(void)
{
    int x,n;
    cout<<"\n\nEnter the values of x and n [in computation of (1+x)^n]";
    cout<<"\n\n x : ";    cin>>x;
    cout<<"\n\n n : ";    cin>>n;
    long double exp=0.0;
   for(long double i=0;i<=97675684;i++)
   {
   exp+=fact(n)*pow(x,i-1)/(fact(i)*fact(n-i));
   }
   cout<<"\n\n"<<exp;
}
long double fact(long int a)
{
long double factorial=1;
while(a!=0)
{   factorial*=a;
    a--;  }
return factorial;
}
//long double pow(long int x,long int y) has been removed by me due to no need
void pac(int n,int r)
{
    clrscr();
    cout<<"\n\nEnter the number of total objects(index), and the no. of places(r)";
    cout<<"\nIndex(n) : "; cin>>n;
    cout<<"\nNo. of Places(r) : "; cin>>r;
    cout<<"\n\nPermutations : "<<fact(n)/fact(n-r);
    cout<<"\n\nCombinations : "<<fact(n)/(fact(r)*fact(n-r));
    cout<<"\n\nCircular Permutations : "<<fact(n-1)/(fact(r-1)*fact(n-r));
}
void trigo(void)
{
  clrscr();
  int ch,x;
  cout<<"Enter what u need (Enter 1,2,3 or 4):"<<"\n\n1. Claculation of Trigonometric Functions"<<"\n\n2. Calculation of T-functions for Half Angles"
  <<"\n\n3. Lenght of sides of triangles if any two/one is given"<<"\n\n4. Back to main menu"<<"\n\n";
  switch(ch)
  {
    case 1: cout<<"Enter the value of x (in radians)";  cin>>x;
            cout<<"\n\nsinx = "<<sin(x);
            cout<<"\n\ncosx = "<<cos(x);
            cout<<"\n\ntanx = "<<tan(x);
            cout<<"\n\ncosecx = "<<1/sin(x);
            cout<<"\n\nsecx = "<<1/cos(x);
            cout<<"\n\ncotx = "<<1/tan(x);
            break;
    case 2: cout<<"Enter the value of x (in radians)"; cin>>x;
            cout<<"\n\nsin(x/2) = "<<sin(x/2);
            cout<<"\n\ncos(x/2) = "<<cos(x/2);
            cout<<"\n\ntan(x/2) = "<<tan(x/2);
            cout<<"\n\ncosec(x/2) = "<<1/sin(x/2);
            cout<<"\n\nsec(x/2) = "<<1/cos(x/2);
            cout<<"\n\ncot(x/2) = "<<1/tan(x/2);
            break;
    case 3: cout<<"Enter the lenght of two sides";
            break;
    case 4: break;
  }
}
void genac(void)
{
    clrscr();
    int a,b;
    cout<<"This section will help you in arithmetic calculations"
    <<"\n\nEnter two numbers one by one";
    cin>>a>>b;
    cout<<"\n\n"<<a<<" + "<<b<<" is : "<<a+b;
    cout<<"\n\n"<<a<<" - "<<b<<" is : "<<a-b;
    cout<<"\n\n"<<a<<" * "<<b<<" is : "<<a*b;
    cout<<"\n\n"<<a<<" / "<<b<<" is : "<<a/b;
}

/*ANY suggestions will be very helpful, and btw its me who will be more benefited, so THANX for that*/ /*I WILL NOT CLAIM IT MINE, any suggestions will be a great help*/

Comments

Popular posts from this blog

Using 'ls' command as a replacement of 'find'

Advantage over find - Actually not probably in terms of speed, but... only point of this is that it's an observation, but... you can do like 'search only in' */*/*Programs* , /*/*Programs*/* , this may compensate the extra time took by using two commands 1. To search in current folder only (1 level... only this folder, no subfolder)     Type... ls | grep Search_Term 2. To search in current folder only (till level 2... this folder + subfolder)     Type... ls * | grep Search_Term #ls and ls * are NOT same! 3. To search in current folder only (till level 3... this folder + subfolder + subfolder)     Type... ls */* | grep Search_Term 4. To search in current folder only (till level 4... this folder + subfolder + subfolder + subfolder)     Type... ls */*/* | grep Search_Term ... and so on... FORMULA - To search till 'n' level (considering current folder as 1)... go till (n-1) stars If wanting to search whole disk... better type star...

Most Code will now be at my GitHub - github.com/adi-g15

Friends... i didn't update this blog for a month. But actually it was the period of time, i LEARNED and DID the most. The sole purpose of this blog for me, was just to put 'Interesting Observations' i used to get during finding or solving the errors, and some just clicked to try. Now, that i have actually been trying many languages and design, so most of the new code part will be on GitHub from now on... Thanks for reading... and I WILL keep posting more inferences here (I got dozens in this month due to the projects ;D ). And special thanks to DevHack1.0 team! GitHub link -> https://github.com/AdityaGupta150

LudO - The Game

/* Programmer - Aditya Gupta (Techy15) Language - C++ Program - LudO - The Game */ /* PLANS- Add functionality for name of player */ //IMP NOTE - See all notes, written in this form "//NOTE..." //NOTE- Mark 'R','G','B','Y' for gotis, ignore doubling for now //NOTE- Settings will have options: change default game play order(ie RBYG), change/give names to each colour //NOTE- Add code in case of attacks //NOTE- Add stops, and ways to show them distinct from others {may require graphics.h} #include<iostream> /* #include<fstream>    To be used in case save & resume to be used*/ #include<cstdio> #include<cstdlib> using namespace std; //Changes on 16th Oct //Show gotis as R1, R2... and ask user to enter string R1 or whatever // // Place within appropriate block ...     short diethrow(){     int fl=1; //holds 0 if decnum is 0     while(fl==0) { char *temp;     ...