In today's I would like to share with you guys a simple program that I wrote how to use union in C programming language I called this program Employee's Profile Using Union in C Language.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.
Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.
My personal website is http://www.jakerpomperada.com
Sample Program Output
Program Listing
/* emp_profile.c
Author : Jake Rodriguez Pomperada,BSCS,MAED-IT
Date : November 29, 2018 Thursday 2:33 PM
Location : Bacolod City, Negros Occidental
Tool : Dev C++ Version 5.11
Website : http://www.jakerpomperada.com
Email : jakerpomperada@jakerpomperada.com and jakerpomperada@gmail.com
*/
#include<stdio.h>
union emp
{
char emp_name[100];
char emp_position[100];
int age;
float salary;
};
void main()
{
union emp profile;
printf("\n\n");
printf("\tEmployee's Profile Using Union");
printf("\n\n");
printf("\tEmployees Name : ");
gets(profile.emp_name);
printf("\n");
printf("\tName : %s\n",profile.emp_name);
printf("\n");
printf("\tEmployees Position : ");
gets(profile.emp_position);
printf("\n");
printf("\tYour position is %s.\n",profile.emp_position);
printf("\n");
printf("\tEmployees Age : ");
scanf("%d",&profile.age);
printf("\n");
printf("\tYour age is %d year(s) old.\n",profile.age);
printf("\n");
printf("\tEmployees Salary : PHP ");
scanf("%f",&profile.salary);
printf("\n");
printf("\tYour salary is PHP %.2f",profile.salary);
printf("\n\n");
printf("\tEnd of Program");
printf("\n\n");
}
No comments:
Post a Comment