Syntax in Square of a number using C++

Posted on 7:13 PM by Glaiza A. Taytay

    Below is the codes of square of a number program using C++ Programming Language.
    The algorithm is so simply and easy to understand. As we all know, the basic formula in square is n^2 or simple n*n. I just use the switch function, if you want to try it again by pressing "y". This one of the basic example in practicing C++ programming language.


#include < stdio.h >
main()
{
int a,b;
char choice;
start:
printf("Enter a number to be square: ");
scanf("%d",&a);
b=a*a;
printf("the square of %d is %d\n",a,b);
printf("Do you want to try it again? (y/n)\n");
scanf("%s",&choice);
if(choice=='y')
goto start;
else
return 0;
}


Cube in C++

Posted on 8:33 PM by Glaiza A. Taytay


    The given codes is for the program in  solving Cube in C++ Programming.


#include < stdio.h >
main()
{
int a,b;
char choice;
start:
printf("Enter a number to be cube: ");
scanf("%d",&a);
b=a*a*a;
printf("the cube of %d is %d\n",a,b);
printf("Do you want to try it again? (y/n)\n");
scanf("%s",&choice);
if(choice=='y')
goto start;
else
return 0;
}
   
     It solves the cube of a number. Just input a number to be cube and it will come up an answer. 


Temperature Conversion of Celsius, Fahrenheit and Kelvin

Posted on 9:40 PM by Glaiza A. Taytay

    How to do a Temperature Conversion of Celsius, Fahrenheit and Kelvin.


    Below is the codes for converting Celsius to Fahrenheit, Celsius to Kelvin, Fahrenheit to Celsius, Fahrenheit to Kelvin, Kelvin to Fahrenheit and Kelvin to Celsius.






#include < stdio.h >
main()
{
int a;
float c,f,k;
char choice;
start:
printf("Temperature Convertion\n");
printf("1. Celsius to Fahrenheit\n");
printf("2. Celsius to Kelvin\n");
printf("3. Fahrenheit to Celsius\n");
printf("4. Fahrenheit to Kelvin\n");
printf("5. Kelvin to Celsius\n");
printf("6. kelvin to Fahrenheit\n");
printf("Enter ur choice:");
scanf("%d",&a);
switch(a)
    {
    case 1:
        {
        printf("\t\t\tCelsius to Fahrenheit\n");
        printf("Enter Celsius Temperature to be converted:: ");
        scanf("%f",&c);
        f=(1.8*c)+32;
        printf("The Fahrenheit temperature is %f\n",f);
        printf("Do you want to try another operation? (y/n)\n");
        scanf("%s",&choice);
        if(choice=='y')
        goto start;
        break;
        }
    case 2:
        {
        printf("\t\t\tCelsius to Kelvin\n");
        printf("Enter Celsius Temperature to be converted: ");
        scanf("%f",&c);
        k=c+273.15;
        printf("The Kelvin temperature is %f\n",k);
        printf("Do you want to try another operation? (y/n)\n");
        scanf("%s",&choice);
        if(choice=='y')
        goto start;
        break;
        }
    case 3:
        {
        printf("\t\t\tFahrenheit to Celsius\n");
        printf("Enter Fahrenheit Temperature to be converted: ");
        scanf("%f",&f);
        c=(f-32)/1.8;
        printf("The Celsius temperature is %f\n",c);
        printf("Do you want to try another operation? (y/n)\n");
        scanf("%s",&choice);
        if(choice=='y')
        goto start;
        break;
        }
    case 4:
        {
        printf("\t\t\tFahrenheit to kelvin\n");
        printf("Enter Fahrenheit Temperature to be converted: ");
        scanf("%f",&f);
        c=(f-32)/1.8;
        k=c+273.15;
        printf("The Kelvin temperature is %f\n",k);
        printf("Do you want to try another operation? (y/n)\n");
        scanf("%s",&choice);
        if(choice=='y')
        goto start;
        break;
        }
    case 5:
        {
        printf("\t\t\tKelvin to Celsius\n");
        printf("Enter Kelvin Temperature to be converted: ");
        scanf("%f",&k);
        c=k-273.15;
        printf("The Celsius temperature is %f\n",c);
        printf("Do you want to try another operation? (y/n)\n");
        scanf("%s",&choice);
        if(choice=='y')
        goto start;
        break;
        }
    case 6:
        {
        printf("\t\t\tKelvin to Fahrenheit\n");
        printf("Enter Kelvin Temperature to be converted: ");
        scanf("%f",&k);
        c=k-273.15;
        f=(1.8*c)+32;
        printf("The Fehrenheit temperature is %f\n",f);
        printf("Do you want to try another operation? (y/n)\n");
        scanf("%s",&choice);
        if(choice=='y')
        goto start;
        break;
        }   
    }
}





    The function used in choosing what conversion to execute was the switch function. In making the program first you should know the algorithm, the flow of the program, how will it look likes.
   C++ Programming is the programming that I've used. It is a low level language and easy to understand.


    Below is the Program for Multiplying, Dividing, Adding and Subtracting two digits using C++ Programming Language.


# include < stdio.h >
main()
{
int a,b,c,d;
float e,f,g;
char choice;
start:
printf("\t\t\t Select an Operation\n");
printf("\t\t\t 1. Addition\n");
printf("\t\t\t 2. Subtraction\n");
printf("\t\t\t 3. Multiplication\n");
printf("\t\t\t 4. Division\n");
printf("\t\t\t Enter your choice:");
scanf("%d",&a);
switch(a){
    case 1:{
        printf("Enter first digit: ");
        scanf("%d",&b);
        printf("Enter second digit: ");
        scanf("%d",&c);
        d=b+c;
        printf("the sum of %d and %d is %d\n",b,c,d);
        printf("Do you want to try another operaion? (y/n)\n");
        scanf("%s",&choice);
        if(choice=='y')
        goto start;
        break;
          }
    case 2:{
        printf("Enter first digit: ");
        scanf("%d",&b);
        printf("Enter second digit: ");
        scanf("%d",&c);
        d=b-c;
        printf("the difference of %d and %d is %d\n",b,c,d);
        printf("Do you want to try another operaion? (y/n)\n");
        scanf("%s",&choice);
        if(choice=='y')
        goto start;
        break;
          }
    case 3:{
        printf("Enter first digit: ");
        scanf("%d",&b);
        printf("Enter second digit: ");
        scanf("%d",&c);
        d=b*c;
        printf("the product of %d and %d is %d\n",b,c,d);
        printf("Do you want to try another operaion? (y/n)\n");
        scanf("%s",&choice);
        if(choice=='y')
        goto start;
        break;
          }
    case 4:{
        printf("Enter first digit: ");
        scanf("%f",&e);
        printf("Enter second digit: ");
        scanf("%f",&f);
        g=e/f;
        printf("the quotient of %f and %f is %f\n",e,f,g);
        printf("Do you want to try another operaion? (y/n)\n");
        scanf("%s",&choice);
        if(choice=='y')
        goto start;
        break;
          }
    }
}



    In making the program first you must declare the variable used if it is an integer, character, float, etc.
I used the switch function for selecting the operation by choosing from 1 to 5. After selecting an operation,  input the digits you want to execute. The inputted digits will be scan and will be executed to the corresponding operation. If you want to try another operation, you just have to select "y" for yes.

Designing a Web Page

Posted on 9:11 PM by Glaiza A. Taytay



     In I.T field, Web design is the skill of creating a presentation of content. It is a kind of a graphic design that is delivered to an end-user through the World Wide Web (www).
    As you can see at Figure 1.a,  it is an example of a a Registration Form Students Information. You will fill up the Text field provided, after you filled up the form and click the submit button. A post method will  be executed.
                                                                                                                                               
Figure 1.a 




    The Datum inputted in the Registration Form will be display in another page which you can seen in Figure 1.b.
    The example web pages shown is designed by using the dreamweaver software for designing the lay out and php language for the posting method.






Figure 1.b