Loll Check out my A.K.A Combination Calculator Am the worst beginner of C programming i guess But still take a look

+1 Divulger Michealson · August 4, 2015
#include <stdlib.h>
#include <math.h>
#include <complex.h>
#include <ctype.h>>
#include <string.h>

int main(){
/*Programming Block
    Program Name: A.K.A Combination Calculator@

    Developer: Mike Divulger

    About: This is a calculator that can do basic additions for you
            you just need to insert two numbers and you will get the end product

    variable:           char B;
                        char k;
                        int e, f, p, u, r;
                        char K;
                        char T;
                        char R;
                        int Sad,Das,Asd,Ads,Com;
                        int Z;
                        char pp;
                        int Tion,tion,Sion,sion,Sick,sick,Pit,pit;

    constant: N/A

    Sturture: Block Programming Style

    Language: Yea its Typically C partially dumb.

    So dive in and it will please you

    and oh i almost forgot dont ask me anything i so cannot explain why i built this

    */


char B;
char k;
int e, f, p, u, r;
char K;
char T;
char R;
int Sad,Das,Asd,Ads,Com;
int Z;
char pp;
int Tion,tion,Sion,sion,Sick,sick,Pit,pit;


for(Z=0; Z<15; Z++){
        if(Z<15){
            Z++;


printf("This is a Full Maths Program Do you Want to continue......? (Y/N)\n");
scanf(" %c", &T);
if( (T=='y')||(T=='Y')||(T=='Yes') ){
printf("Do You Want to Add, sub, Div, Mul? 'Y,y' If you want to continue or 'N,n' If you want to do some other operations  (Y/N)\n");
scanf(" %c", &k);

if( (k=='Y')||(k=='y') ){
        printf("What Operation Do You Want To Do?\n\t""A) Addition\n\t""B) Subtraction\n\t""C) Division\n\t""D) Multiplication\n\t""E) All\n");
        scanf(" %c", &B);

if( (B == 'a')||(B == 'A') ){
   printf("Enter The Two numbers Below\n");
    scanf(" %i", &e);
    scanf(" %i", &f);
    printf("The Sum of %i + %i = %i\n\n", e, f, e + f);


}else if( (B == 'B')||(B == 'b') ){
     printf("Enter The Two numbers Below\n");
     scanf(" %i", &e);
    scanf(" %i", &f);
    printf("The Remainder of %i - %i = %i\n\n", e, f, e - f);
}else if( (B == 'c')||(B == 'C') ){
    printf("Enter The Two numbers Below\n");
    scanf(" %i", &e);
    scanf(" %i", &f);
    printf("The Quetient of %i / %i = %i\n\n", e, f, e / f);

}else if( (B == 'd')||(B == 'D') ){
      printf("Enter The Two numbers Below\n");
      scanf(" %i", &e);
    scanf(" %i", &f);
    printf("The Result of %i * %i = %i\n\n", e, f, e * f);
}else if( (B == 'E')||(B == 'e') ){

printf("These Are the Operation you will Be running Enter:\n\t""A) Addition\n\t""B) Subtraction\n\t""C) Division\n\t""D) Multiplication\n");
scanf(" %c", &B);
int F;
for(F=16; F>=16; F++){

        F++;
if( (B == 'a')||(B == 'A') ){
 printf("Enter The Two numbers You want the sum of Below\n");
    scanf(" %i", &tion);
    scanf(" %i", &Tion);
    printf("The Sum of %i + %i = %i\n\n",tion, Tion, Tion+tion );
  continue;
   }

else if( (B == 'B')||(B == 'b') ){
     printf("Enter The numbers you want to sunbtract Below\n");
     scanf(" %i", &sion);
    scanf(" %i", &Sion);
    printf("The Remainder of %i - %i = %i\n\n", sion, Sion, sion - Sion);
    continue;
    }
    else if( (B == 'C')||(B == 'c') ){
     printf("Enter The Two numbers you want to divide Below\n");
   scanf(" %i", &Sick);
    scanf(" %i", &sick);
    printf("The Quetient of %i / %i = %i\n\n",Sick, sick, Sick / sick );
    continue;
    }
    else if( (B == 'D')||(B == 'd') ){
        printf("Enter The Two numbers you want to multiply Below\n");
     scanf(" %i", &Pit);
    scanf(" %i", &pit);
    printf("The Result of %i * %i = %i\n\n",Pit, pit, Pit * pit);
    break;
}else{
    printf("Invalid Response\a\n\n");
}
}

}

else{
    printf("Invalid Response!!!!\a\n");
    printf("********************************************************************************\n\n");
}
}else if( (k=='n')||(k=='N') ){
    printf("\nDo you want to move on?(Y/N)\n");
    scanf(" %c", &K);

if( (K=='Y')||(K=='y') ){
char n;
int l= e + f;
int m= e - f;
int v= e / f;
int o= e * f;
float avg;

printf("\nDo you Want To Check the Average Of Addition and Subtraction, Division & Mutiplication ? Or You Wan to do All? (Y/N/All/A)\n");

scanf(" %c", &n);
if( (n == 'Y') ||(n=='y')){
    printf("Enter the numbers you Want the varage of\n");
    scanf(" %i\n", &l);
    scanf(" %i\n", &m);
    scanf(" %i\n", &o);
    scanf(" %i", &v);

    avg = (l+m+v+o) / 4;
    printf("\nThe Average of the above is: %.2f\n\n", avg);
}else if( (n=='a')||(n=='All')||(n=='A') ){

    printf("Are you sure\n");
    scanf(" %c", &R);
    if( (R=='y')||(R=='Y') ){
        printf("Enter the numbers You want to calculate\n");
        scanf(" %i", &Das);
        scanf(" %i", &Sad);
        scanf(" %i", &Asd);
        scanf(" %i", &Ads);
        Com = (Das + Sad + Asd + Ads) / 4;
        printf("\nThe Average of the Number %i + %i + %i + %i = %i\n", Das, Sad, Asd, Ads, Com);
         printf("********************************************************************************\n\n");


    }else if( (R=='n')||(R=='N') ){

        printf("\n Enter your name Below\n");
        scanf(" %c", &pp);
        if(pp==pp){
        printf(" %c Thank you for using this program Goodbye\n\n", pp);

}else{
printf("Invalid Response!!!!\a");
    printf("********************************************************************************\n\n");
}

}else{
         printf("Invalid Response!!!!\a");
    printf("********************************************************************************\n\n");

}

}else if( (n == 'n')||(n == 'N') ){
    printf("Thanks for that in we will See you Again!!!");
    printf("********************************************************************************\n\n");


}else{
    printf("Invalid Response!!!!\a");
    printf("********************************************************************************\n\n");
}
}else if( (K=='nothing')||(K=='n')||(K=='N') ){

    printf("Thanks For Attempting This Program Goodbye!!\n");
        printf("********************************************************************************\n");


}else{
    printf("Invalid Response!!!!\a\n");
    printf("********************************************************************************\n\n");
}


}
}else if( (T=='n')||(T=='N')||(T=='No') ){
    printf("Well Now Is The Time To Leave!!!!\n");
        printf("********************************************************************************\n\n");
        break;

}else{
    printf("Invalid Response You Numskull!!!\a\n");
    printf("********************************************************************************\n\n");
}
}
}
    return 0;
}








Post a Reply

Replies

Oldest  Newest  Rating
+1 David Green · August 4, 2015
I've reviewed your code and suggested different things in the form of comments. http://pastebin.com/aWB9CuRy
+1 Divulger Michealson · August 5, 2015
Yea afterall I wasn't finish but anyways I wanna build a smart calculator like a smart phone I want to build a smart calculator 

But I built this took about 30 mins 
+1 Divulger Michealson · August 5, 2015
j
+1 c student · August 5, 2015
it might be better to set up a queue with a linked list structure to read in numbers and operators.  when the user has typed out an equation as a string in stdin and presses enter, it will process the queue and perform the operations on the numbers by first prioritizing operators in order of operations.  this way, you dont have to keep prompting the user for numbers and operators.
perhaps something like this:
typedef struct number *Number;
typedef struct operator *Operator;
typedef struct equation *Equation;

// contains number and points to the next operator
struct number {
int num;
Operator operation;
};

// contains operator and points to next number
struct operator {
char operator;
Number nextNum;
};

// head of the list and points to the beginning of the equation
struct equation {
Number first;
};
+1 David Green · August 5, 2015
It was good review for me either way. Thank you for publishing it.
+1 Divulger Michealson · August 5, 2015
smart move thats what i wanna do its because i started C 2-4 days ago why am not so skilled at it 
  • 1

C

107,229 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator