/* Nicolas Lozano
9/20/2020
Lab Section 9
Lab #4
This code is supposed to take diffrent inputs and create a file with
their outputs. The code takes an uppercase letter and turns it into a lowercase
letter. It then spits out the decimal, octal, and hex forms of the lowercase.
The code does the same with lowercase letters but turns them into uppercase
letters. the code also takes the ASCII decimal value and turns it into a 
character. Finally the code gives the valuse of any number from 1-32 to its
third power.*/

#include <stdio.h>
#include <math.h>
#include <ctype.h>

int main(void){
	char cap;
	char lower;
	int int1;
	int int2;

    	fprintf(stderr, "Enter a capital letter: ");
		fscanf(stdin, " %c", &cap);
		//The code above stores a character named cap so it can be used later
		fprintf(stdout, "The lowercase of %c is: ", cap);
		//This code uses the variable stored before in a string
		fprintf(stdout, "%c", tolower(cap));
		//This code makes the uppercase variable into a lowercase variable
		fprintf(stdout, "\nThe ASCII values for %c are:\n", tolower(cap));
		fprintf(stdout, "%-16s%-16s%-16s\n", "DECIMAL", "OCTAL", "HEX");
                fprintf(stdout,"%-16d%#-16o%#-16x",tolower(cap),tolower(cap),tolower(cap));
		//This code makes the table for the output

	fprintf(stderr, "Enter a lowercase letter: ");
		fscanf(stdin, " %c", &lower);
		//The code above stores a character named lower so it can be used later
                fprintf(stdout, "\nThe uppercase of %c is: ", lower);
                fprintf(stdout, "%c", toupper(lower));
                //This code makes the lowercase variable into a uppercase variable
                fprintf(stdout, "\nThe ASCII values for %c are:\n", toupper(lower));
                fprintf(stdout, "%-16s%-16s%-16s\n", "DECIMAL", "OCTAL", "HEX");
                fprintf(stdout,"%-16d%#-16o%#-16x",toupper(lower),toupper(lower),toupper(lower));
                //This code makes the table for the output

	fprintf(stderr, "Enter an integer (33 - 126): ");
		fscanf(stdin, " %i", &int1);
                //The code above stores a character named int1 so it can be used later
		fprintf(stdout, "\nThe ASCII character of %i is: ", int1);
		fprintf(stdout,"%c", int1);
		//This code makes the decimal value into an ASCII character

	fprintf(stderr, "Enter an integer: ");
		fscanf(stdin, " %i", &int2);
		//The code above stores a character named int2 so it can be used later
		fprintf(stdout, "\n%i cubed is ", int2);
		fprintf(stdout, "%.1f\n", pow(int2,3));
		//This code makes the integer get raised to the power of 3

return 0;
}

