Programming C Language

Post on 23-Jun-2015

451 views 2 download

Transcript of Programming C Language

The Best

Team Leader: Brian ByrdTeam Members: Heather Garn, Diane Joyner

Natara Fonseca, Derek RicksDavid Au

Introduction

Reason for the program

Process to make the program

Each team members part

Limitations of the program

First Function

int easyadd(int a, int b)// easyadd function definition{ int sum1=0;//declare and intilize sum1 sum1= a+ b;// equation to add two numbers return sum1;// return the sum1}//end function

int easyadd(int a, int b);// prototype for easy add

if (easyadd(num1, num2)== answer)// function call

printf("Wrong! The correct answer is %d\n", easyadd(num1, num2));// function call to tell the right answer

Second Functionint hardadd(int c, int d);// prototype for hard add

if (hardadd(num3, num4)== answer)// call function to check their answer

printf("Wrong! The correct answer is %d\n", hardadd(num3, num4));// call function for correct answer

int hardadd(int c, int d )// hardadd function definition{ int sum2=0;//declare and intilize sum2 sum2= c+ d;// equation to add two numbers return sum2;// return the sum2}// end function

Third Functionint easysub(int e, int f);// prototype for easy subtract

if (easysub(num5, num6)== answer)// call function to check their answer

printf("Wrong! The correct answer is %d\n", easysub(num5, num6));// call function to give correct answerint easysub(int e, int f)//easy subtract function definition{ int sum3=0;//declare and intilize sum3 sum3= e-f;// equation to subtract two numbers return sum3;// return the sum3}// end function

Fourth Functionint hardsub(int g, int h);// prototype for hard subtract

if (hardsub(num7, num8)== answer)// call function to check their answer

printf("Wrong! The correct answer is %d\n", hardsub(num7, num8));// call function to output the correct answer int hardsub(int g, int h)//hard subtract function definition{ int sum4=0;//declare and intilize sum4 sum4= g-h;// equation to subtract two numbers return sum4;// return sum4}// end function

Fifth Functionint grade(int number);// prototype for number grade

printf("You got %d percent correct\n", grade(correct));// call function for the number grade

int grade(int number)// grade number function definition{ int grade;// declare variable grade grade=number*10;// equation to turn the number of correct answers to a number grade return grade;// return grade}// end function

Sixth Function

printf("You got an %c", lgrade(correct));// call letter grade function to tell what their grade is

char lgrade(int number);// prototype for letter grade

Sixth Function- Continuechar lgrade(int number)//letter grade function definition{ int grade;// declare variable grade grade=number*10;// equation to turn the number of correct answers to a number grade if(grade>=90)//if grade is 100-90 return 'A';// return an A grade letter else if (grade>=80)// if grade is 89-80 return 'B';// return an B grade letter else if (grade>=70)// if grade is 79-70 return 'C';// return an C grade letter else if (grade>=60)// if grade is 69-60 return 'D';// return an D grade letter else// if grade is 59 or lower return 'F';// return an F grade letter}// end of function

Conclusion

Helpful to Elementary School Students

What we could include in the future

Any Questions?