Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- program : velandoRpgm2.c
- author : Rafael Velando
- purpose : Implement calling methods/functions, if, else if, else, while, for, printf,
- taking data in double dimension array apart, math methods/functions, ascii values,
- updated : 10-12-2011
- *********************************************************************
- Course : COP 2270 T-FR 12:50 PM
- Professor : Michael Robinson
- Due Date : 10/11/11
- Certification:
- I hereby certify that this work is my own and none of it is the work of any other person.
- *********************************************************************
- */
- #include <stdio.h>
- #include <math.h>
- #include <string.h>
- #include <stdlib.h>
- void processAbsoluteValues(int i, int j, double x, double y )
- {
- printf("Abs. Val of %d is %d\n", i, abs(i));
- printf("Abs. Val of %d is %d\n", j, abs(j));
- printf("Abs. Val of %.1f is %.1f\n", x, fabs(x));
- printf("Abs. Val of %.2f is %.2f\n", y, fabs(y));
- }
- void processRoundValues(int i, int j, double x, double y )
- {
- printf("Rounded Val of %d is %d\n", i, round(i));
- printf("Rounded Val of %d is %d\n", j, round(j));
- printf("Rounded Val of %.1f is %.1f\n", x, round(x));
- printf("Rounded Val of %.2f is %.2f\n", y, round(y));
- }
- void processCeilingValues(int i, int j, double x, double y )
- {
- printf("Ceiling Val of %d is %d\n", i, ceil(i));
- printf("Ceiling Val of %d is %d\n", j, ceil(j));
- printf("Ceiling Val of %.1f is %.1f\n", x, ceil(x));
- printf("Ceiling Val of %.2f is %.2f\n", y, ceil(y));
- }
- void processFlooringValues(int i, int j, double x, double y )
- {
- printf("Floor Val of %d is %d\n", i, floor(i));
- printf("Floor Val of %d is %d\n", j, floor(j));
- printf("Floor Val of %.1f is %.1f\n", x, floor(x));
- printf("Floor Val of %.2f is %.2f\n", y, floor(y));
- }
- void processTrigFunctionsValues(int i, int j, double x, double y )
- {
- printf("The Cos of %d is %.2f\n", i, cos((double)i));
- printf("The Cos of %d is %.2f\n", j, cos((double)j));
- printf("The Cos of %.1f is %.2f\n", x, cos(x));
- printf("The Cos of %.2f is %.2f\n", x, cos(y));
- printf("The Sin of %d is %.2f\n", i, sin((double)i));
- printf("The Sin of %d is %.2f\n", j, sin((double)j));
- printf("The Sin of %.1f is %.2f\n", x, sin(x));
- printf("The Sin of %.2f is %.2f\n", x, sin(y));
- printf("The Tan of %d is %.2f\n", i, tan((double)i));
- printf("The Tan of %d is %.2f\n", j, tan((double)j));
- printf("The Tan of %.1f is %.2f\n", x, tan(x));
- printf("The Tan of %.2f is %.2f\n", x, tan(y));
- }
- void processExponentialValues(int i, int j, double x, double y )
- {
- printf("Exp. Val of %d is %.1f\n", i, exp(i));
- printf("Exp. Val of %d is %.1f\n", j, exp(j));
- printf("Exp. Val of %.1f is %.1f\n", x, exp(x));
- printf("Exp. Val of %.2f is %.1f\n", y, exp(y));
- }
- void processLogValues(int i, int j, double x, double y )
- {
- printf("Log Val of %d is %.1f\n", i, log(i));
- printf("Log Val of %d is %.1f\n", j, log(j));
- printf("Log Val of %.1f is %.1f\n", x, log(x));
- printf("Log Val of %.2f is %.1f\n", y, log(y));
- }
- void processPowerValues(int i, int j, double x, double y )
- {
- printf("%d to the power %d is %.1f\n", i, j, pow((double)i,j));
- printf("%.1f to the power %.2f is %.1f\n", x, y, pow(x,y));
- }
- void processSquareRootsValues(int i, int j, double x, double y )
- {
- printf("The Square Root of %d is %.1f\n", i, sqrt(i));
- printf("The Square Root of %d is %.1f\n", j, sqrt(j));
- printf("The Square Root of %.1f is %.1f\n", x, sqrt(x));
- printf("The Square Root of %.2f is %.1f\n", y, sqrt(y));
- }
- void processRandomValues(int i, int j, double x, double y )
- {
- printf("A Random Value generated from my program is %d\n", rand());
- printf("A Random Value generated from my program is %d\n", rand());
- printf("A Random Value generated from my program is %d\n", rand());
- printf("A Random Value generated from my program is %d\n", rand());
- }
- void NameBrokenDown(char myName[])
- {
- int d;
- for(d = 0;d < strlen(myName); d++)
- {
- printf("char [%c] located at position %d is ", name[d], d);
- if((myName=='a') || (myName=='A') || (myName=='e') || (myName=='E') || (myName=='i') || (myName=='I') || (myName=='o') || (myName=='O') || (myName=='u') || (myName=='U'))
- printf("a vowel\n");
- elseif((myName=='$') || (myName=='%'))
- printf("not a vowel or a consonant\n");
- elseif(myName==' ')
- printf("a space\n");
- else
- printf("a consonant\n");
- }
- }
- int main()
- {
- int i = 3;
- int j = 7;
- double x = 54.3;
- double y = -1.22;
- char myName[] = "Rafael $ Victor % Velando";
- processAbsoluteValues(i, j, x, y );
- processRoundValues(i, j, x, y );
- processCeilingValues(i, j, x, y );
- processFlooringValues(i, j, x, y );
- processTrigFunctionsValues(i, j, x, y );
- processExponentialValues(i, j, x, y );
- processLogValues(i, j, x, y );
- processPowerValues(i, j, x, y );
- processSquareRootsValues(i, j, x, y );
- processRandomValues(i, j, x, y );
- NameBrokenDown(myName);
- return 0;
- }
Add Comment
Please, Sign In to add comment