Saturday, October 7, 2017

Date Sum Using Structure in C/C++ Language

0 comments

Problem

Create a struct called data. User should be able to input day, month, and year. Take two date inputs and add them. Display the result.

Code

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>

//struct decleration
struct data {
int years;
int months;
int days;
}d1,d2;

//function protorypes
void add_data();
void add_dates();
void display(int ,int ,int);

int main()
{
    //function calls
    add_data();
    add_dates();
   
printf ("\n\nPress any key to exit.");
getch();
return 0;
}

//adding record
void add_data()
{
     //1st date
     printf ("Enter 1st date.");
   
     printf ("\n\nEnter year: ");
     scanf ("%d",&d1.years);
   
     printf ("\nEnter month: ");
     scanf ("%d",&d1.months);
   
     printf ("\nEnter day: ");
     scanf ("%d",&d1.days);
   
     display(d1.days,d1.months,d1.years);
     //printf ("\n\nThe 1st date is %d/%d/%d",d1.days,d1.months,d1.years);
   
     //Second time
     printf ("\n\n\nNow, please type the 2nd date.");
   
     printf ("\nEnter year: ");
     scanf ("%d",&d2.years);
   
     printf ("\nEnter month: ");
     scanf ("%d",&d2.months);
   
     printf ("\nEnter day: ");
     scanf ("%d",&d2.days);
   
     display(d2.days,d2.months,d2.years);
}

void display (int a,int b,int c)
{
     printf("\nThe date is %d/%d/%d \n\n", a,b,c);
}   

void add_dates()
{
     int y,m,d;
   
     y = d1.years + d2.years;
     m = d1.months + d2.months;
     d = d1.days + d2.days;
   
     printf ("\n\n\nSum of the date's is %d/%d/%d",d,m,y);
}

Output

Date Sum Using Structure in C/C++ Language
Date Sum Using Structure in C/C++ Language

Read More..

Sunday, October 1, 2017

Time Sum Using Structure in C/C++ Language

1 comments

Problem

Create a structure called time. Its three members, all type int, should be called hours, minutes, and seconds. Write a program that prompts the user to enter a time value in hours, minutes, and seconds. This can be in 12:59:59 format, or each number can be entered at a separate prompt (“Enter hours:”, and so forth). The program should then store the time in a variable of type struct time, and finally print out the total number of seconds represented by this time value:
long totalsecs = t1.hours*3600 + t1.minutes*60 + t1.seconds

Code

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>

struct time {
int hours;
int minutes;
int seconds;
};

//function prototype
void add (int,int,int,int,int,int);

int main()
{
    struct time t1,t2;
   
    //1st time
    printf ("Enter 1st time.");
   
printf ("\n\nEnter Hours: ");
scanf ("%d",&t1.hours);

printf ("\nEnter Minutes: ");
scanf ("%d",&t1.minutes);

printf ("\nEnter Seconds: ");
scanf ("%d",&t1.seconds);

    printf ("\n\nThe Time is %d:%d:%d",t1.hours,t1.minutes,t1.seconds);
   
    //Second time
    printf ("\n\n\nNow, please type the 2nd time.");
   
    printf ("\n\nEnter Hours: ");
scanf ("%d",&t2.hours);

printf ("\nEnter Minutes: ");
scanf ("%d",&t2.minutes);

printf ("\nEnter Seconds: ");
scanf ("%d",&t2.seconds);

    printf ("\n\nThe Time is %d:%d:%d",t2.hours,t2.minutes,t2.seconds);
   
    //function call
    add (t1.hours,t1.minutes,t1.seconds,t2.hours,t2.minutes,t2.seconds);
   
printf ("\n\nPress any key to exit.");
getch();
return 0;
}

//function definition
void add (int x,int y,int z,int a,int b,int c)
{
     int h,m,s;
   
     h = x + a;
     m = y + b;
     s = z + c;
   
     printf ("\n\n\nSum of the two time's is %d:%d:%d",h,m,s);
}

Code

Time Sum Using Structure in C/C++ Language
Time Sum Using Structure in C/C++ Language

Read More..

Sunday, September 24, 2017

Input Length and Breadth. Calculate Area and Perimeter Using Struct in C Language

0 comments

Problem:

Write a program which takes length and breadth as input. Than calculate area and perimeter of the room.

Code

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>

struct distance{
int length;
int width;
};
struct room{
struct distance a;
}r;

void myftn();

int main()
{
myftn();


printf ("\n\nPress any key to exit.");
getch();
return 0;
}

void myftn ()
{
int p,s;

printf ("Enter lengtgh: ");
scanf ("%d",&r.a.length);
printf ("Enter widtgh: ");
scanf ("%d",&r.a.width);

p = 2 * (r.a.length * r.a.width);
s = (r.a.length * r.a.width);

printf ("\n\nArea = %d",s);
printf ("\nPerimeter = %d",p);
}

Output

Input Length and Breadth. Calculate Area and Perimeter Using Struct in C Language
Input Length and Breadth. Calculate Area and Perimeter Using Struct in C Language



Read More..

Wednesday, September 17, 2014

program that asks the user to input n number of records that he/she wants to enter by using malloc function, then display the user input values

0 comments

Problem

Student structure contains the following contents:
Roll number (int), Name (string), Department (string), Course (string), Year of joining (string), cgpa (float)
Write a program that first prompts the user to input the n number of student records that he/she wants to input in that program. Then use malloc function to dynamically allocate memory that has n number of elements (type of each element is struct student). Then input records from user and display them on screen.
Hint:  p = (struct student*) malloc(sizeof (struct student) * n);

Solution - Code

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
struct student
{
 char name[30];
 int roll_no;
 char department[30];
 char course[30];
 int year;
 float cgpa;
};
main()
{
 struct student *s;
 int i,how_many;

 printf ("Number of student data you want to enter");
 scanf ("%d",&how_many);

 s = (struct student*) malloc(sizeof(struct student) * how_many);

 for (i=0;i<how_many;i++)
 {
  fflush(stdin);
  printf ("enter name: ");
  gets(&s[i].name);

  printf ("Enter Roll no: ");
  scanf ("%d",&s[i].roll_no);

  fflush(stdin);
  printf ("enter department: ");
  gets (&s[i].department);

  fflush (stdin);
  printf ("enter course: ");
  gets (&s[i].course);

  printf ("enter year: ");
  scanf ("%d",&s[i].year);

  printf ("enter cgpa: ");
  scanf ("%f",&s[i].cgpa);
 }

 printf("\nAnd here is whhat you have entered\n\n");
 for (i=0;i<how_many;i++)
  printf("Name = %s\n\nRoll No. = %d\n\nDepartment = %s\n\nCopurse = %s\n\nYear = %d\n\n",s[i].name,s[i].roll_no,s[i].department,s[i].course,s[i].year);

 system("pause");
}

Sample Output


using malloc function

Read More..

write a structure for student data, also define functions to display and search that data

0 comments

Problem

Student structure contains the following contents
Roll number (int), Name (string), Department (string), Course (string), Year of joining (string), cgpa (float)
Write the definition of the functions whose prototype is given below:
  1. void display(struct strudent s);
    This function display the content of struct student s
  2. void display(struct strudent *p);
    This function displays the content of a structure pointed by pointer *p
  3. void search(struct strudent *p, int roll_no);
    The first parameter is the base address of an array of type struct student and second parameter is the roll no of the structure. This function search's the record from array of structure (first parameter) whose Roll number is same as roll_no (second parameter)

Solution - Code

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
struct student
{
 char name[30];
 int roll_no;
 char department[30];
 char course[30];
 int year;
}s[5];
int i;
void searchstudent (struct student *, int );
void disp();
void display (struct student *);
main()
{
 int rl,p;

 for (i=0;i<5;i++)
 {
  printf ("Enter name, ID, department, course, year : ");
  scanf("%s%d%s%s%d",&s[i].name,&s[i].roll_no,&s[i].department,&s[i].course,&s[i].year);
 }

 disp();
 display(s);

 printf ("Enter number you want to search : ");
 scanf("%d",&rl);

 searchstudent (s ,rl);

 system("pause");
}
//************
void disp()
{
 for (i=0;i<5;i++)
 {
  printf("And here is whhat you have entered.\n\n");
  printf("Name = %s\n\nRoll No. = %d\n\nDepartment = %s\n\nCopurse = %s\n\nYear = %d\n\n",s[i].name,s[i].roll_no,s[i].department,s[i].course,s[i].year);
 }
}
//************************
void display (struct student *p)
{
 printf("Name = %s\n\nRoll No. = %d\n\nDepartment = %s\n\nCopurse = %s\n\nYear = %d\n\n",p->name,p->roll_no,p->department,p->course,p->year);
}
void searchstudent (struct student *p, int roll_no)
{
 int i,found = 0;
 for(i=0;i<5;i++)
 {
  if(p->roll_no == roll_no)
  {
   printf("record found");
   printf("Name = %s\n\nRoll No. = %d\n\nDepartment = %s\n\nCopurse = %s\n\nYear = %d\n\n",p->name,p->roll_no,p->department,p->course,p->year);
   found = 1;
  }
 }
 if (found == 0)
  printf("Not found");
}

Sample Output


display & search data using structure

Read More..

Sunday, September 14, 2014

create a menu driven library management program using structure and functions

0 comments

Problem

Write a menu driven program that depicts the working of a library. The menu options should be:
  1. Add book information
  2. Display book information
  3. List all books of given author
  4. List the title of specified book
  5. List the count of books in the library
  6. List the books in the order of accession number
  7. Exit
Create a structure called library to hold accession number, title of the book, author name, price of the book, and flag indicating whether book is issued or not. Create an array of size 25 of type library. Input record from user and check all the options of the program.

Solution - Code

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>

void add_book();
void disp_book();
void book_auth();
void count_book();

struct lib
{
 int acc_no;
 char book_title[20];
 char author[20];
 int cost;
}b[100];
int count;
main()
{
 int ch;
 while(1)
 {
  printf("\n 1:enter the book info\n");
  printf("\n 2:display book info\n");
  printf("\n 3:book author\n");
  printf("\n 4:count book\n");
  printf("\n 5:exit\n");
  printf("\n enter the choice \n");
  scanf("%d",&ch);
  switch(ch)
  {
   case 1:
    add_book();
    getch();
    break;
   case 2:
    disp_book();
    getch();
    break;
   case 3:
    book_auth();
    getch();
    break;
   case 4:
    count_book();
    getch();
    break;
   case 5:
    exit(0);
  }
 }
}
//-----------------------------------
void add_book()
{
 if(count==9)
 {
  printf("\n no more space\n");
  return;
 }
 printf("\n enter the detail of book \n");
 printf("\n enter accession number of book =");
 scanf("%d",&b[count].acc_no);
 fflush(stdin);
 printf("\n enter the book title=");
 gets(b[count].book_title);
 fflush(stdin);
 printf("\n enter the name of author=");
 gets(b[count].author);
 fflush(stdin);
 printf("\n enter the cost of book=");
 scanf("%d",&b[count].cost);
 count++;
}
//***********************
void disp_book()
{
 int i;
 printf("\n detail of %d booksin library",count);
 for(i=0;i<count;i++)
 {
  printf("\n %d\n%s\n%s\n%d",b[i].acc_no,b[i].book_title,b[i].author,b[i].cost);
 }
}
//*********************
void book_auth()
{
 int i,cnt=0;
 char name[20];
 printf("\n enter the name of author=");
 gets(name);
 for(i=0;i<count;i++)
 {
  if(strcmp(name,b[i].author)==0)
  {
   cnt++;
   printf("\n %d\n%s\n%s\n%d",b[i].acc_no,b[i].book_title,b[i].author,b[i].cost);
  }
 }
 if(cnt==0)
  printf("\n no such book \n");
}
//*******************************
void count_book()
{
 printf("\n total no of book in library =%d",count);
}

Sample Output

add book record c language

display library books

display total library books in c language

Read More..

compare two given dates using structure

2 comments

Problem

Write a program that compares two given dates. To store date use structure say date that contains three members namely date, month, and year. If the dates are equal then display message as "Equal" otherwise "Unequal".

Solution - Code

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
struct date
{
 int date;
 int month;
 int year;
};
int main ()
{
 int i,f=0;  struct date d[2];  for(i=0;i<2;i++)
 {
  printf("\nEnter day for the %dth date\n",i+1);
  scanf("%d",&d[i].date);

  printf("\nEnter the month for the %dth date\n",i+1);
  scanf("%d",&d[i].month);

  printf("\nEnter the year for the %dth date\n",i+1);
  scanf("%d",&d[i].year);
 }
 if(d[0].date==d[1].date)
 {
  if(d[0].month==d[1].month)
  {
   if(d[0].year==d[1].year)
   {
    f=1;
   }
  }
 }
 if(f==1)
  printf("\nThe dates are equal");
 else
  printf("\nThe dates are not equal");

 printf ("\n\npress any key to close.");
 getch();
}

Sample Output

compare dates using structure

Read More..

write a program that allows the user to input data and search

0 comments

Problem

Create a structure to specify data on students given below:
Roll number, Name, Department, Course, Year of joining
Create an array of structure. Use a loop to input values and then display those values. Also write a function:
void searchstudent (int roll_no);
This function will search a student record from that array whose Roll number is same as roll_no and display that record otherwise it displays record not found.

Solution - Code

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
void searchstudent (int roll_no);
struct book
{
 int roll;
 char name[20];
 char department[20];
 char course[20];
 int year;
}b[2];
int main ()
{
 int i, roll_no;

 for (i=0;i<2;i++)
 {
  printf ("Enter roll no. : ");
  scanf ("%d",&b[i].roll);

  fflush (stdin);
  printf ("Enter name: ");
  gets (b[i].name);

  fflush (stdin);
  printf ("Enter department: ");
  gets (b[i].department);

  fflush (stdin);
  printf ("Enter course: ");
  gets (b[i].course);

  printf ("Enter year: ");
  scanf ("%d",&b[i].year);
 }

 for (i=0;i<2;i++)
  printf("\n\nRoll number: %d\nName: %s\nDepartment: %s\nCourse: %s\nYear: %d\n",b[i].roll,b[i].name,b[i].department,b[i].course,b[i].year);

 printf ("SEARCH DATA(enter roll number): ");
 scanf ("%d",&roll_no);

 searchstudent(roll_no);

 printf ("\npress any key to close.");
 getch();
}
void searchstudent (int roll_no)
{
 int i;

 for (i=0;i<2;i++)
 {
  if (roll_no == b[i].roll)
   printf("\n\nRoll number: %d\nName: %s\nDepartment: %s\nCourse: %s\nYear: %d\n",b[i].roll,b[i].name,b[i].department,b[i].course,b[i].year);
 }
}

Sample Output

search of a student using structure

Read More..

create an array of structure to display user input values

0 comments

Problem

Create a structure to specify data on students given below:
  • Roll number
  • Name
  • Department
  • Course
  • Year of joining
Create an array of that structure. Use a loop to input values and then display those values.

Solution - Code

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
struct book
{
int roll;
char name[20];
char department[20];
char course[20];
int year;
}b[2];
int main ()
{
 int i;

 for (i=0;i<2;i++)
 {
  printf ("Enter roll no. : ");
  scanf ("%d",&b[i].roll);

  fflush (stdin);
  printf ("Enter name: ");
  gets (b[i].name);

  fflush (stdin);
  printf ("Enter department: ");
  gets (b[i].department);

  fflush (stdin);
  printf ("Enter course: ");
  gets (b[i].course);

  printf ("Enter year: ");
  scanf ("%d",&b[i].year);
 }

 for (i=0;i<2;i++)
  printf("\n\nRoll number: %d\nName: %s\nDepartment: %s\nCourse: %s\nYear: %d\n",b[i].roll,b[i].name,b[i].department,b[i].course,b[i].year);

 printf ("\npress any key to close.");
 getch();
}

Sample Output

using array of structure to display user input data

Read More..

Create a structure that stores student data and then display it

0 comments

Problem

Create a structure to specify data on students given below:
  • Roll number
  • Name
  • Department
  • Course
  • Year of joining
Create a variable of that structure, input some value from user and then display those values.

Solution - Code

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include <string.h>
struct book
{
 int roll;
 char name[20];
 char department[20];
 char course[20];
 int year;
}b;
int main ()
{
 printf ("Enter roll no. : ");
 scanf ("%d",&b.roll);

 fflush (stdin);
 printf ("Enter name: ");
 gets (b.name);

 fflush (stdin);
 printf ("Enter department: ");
 gets (b.department);

 fflush (stdin);
 printf ("Enter course: ");
 gets (b.course);

 printf ("Enter year: ");
 scanf ("%d",&b.year);

 printf("\nRoll number: %d\nName: %s\nDepartment: %s\nCourse: %s\nYear: %d\n",b.roll,b.name,b.department,b.course,b.year);

 printf ("\npress any key to close.");
 getch();
}

Sample Output

display user input data using structure

Read More..

Tuesday, September 9, 2014

Library management using structure

8 comments

Problem

Write a menu driven program that depicts the working of a library. The menu options should be:
  1. Add book information
  2. Display book information
  3. List all books of given author
  4. List the title of specified book
  5. List the count of books in the library
  6. List the books in the order of accession number
  7. Exit
Create a structure called library to hold accession number, title of the book, author name, price of the book, and flag indicating whether book is issued or not.

Solution - Code

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
struct library
{
 char bk_name[30];
 char arthur[30];
 int pages;
 float price;
};

int main()
{
 struct library l[3];
 char ar_nm,bk_nm;
 int i,j;

 printf ("1. Add book information\n2. Display book information\n3. List all books of given author\n4. List the title of specified book\n5. List the count of books in the library\n6. Exit");

 printf ("\n\nEnter one of the above : ");
 scanf("%d",&j);

 switch (j)
 {
  case 1:
   for (i=0;i<3;i++)
   {

    printf ("Enter book name = ");
    scanf ("%s",&l[i].bk_name);

    printf ("Enter arthur name = ");
    scanf ("%s",&l[i].arthur);

    printf ("Enter pages = ");
    scanf ("%d",&l[i].pages);

    printf ("Enter price = ");
    scanf ("%f",&l[i].price);
   }
   break;
  case 2:
   printf("you have entered the following information\n");
   for(i=0;i<3;i++)
   {
    printf ("book name = %s",l[i].bk_name);

    printf ("arthur name = %s",l[i].arthur);

    printf ("pages = %d",l[i].pages);

    printf ("price = %f",l[i].price);
   }
   break;

  case 3:
   printf ("Enter arthur name : ");
   scanf ("%s",&ar_nm);
   for (i=0;i<3;i++)
   {
    if (ar_nm == l[i].arthur)
     printf ("%s %s %d %f",l[i].bk_name,l[i].arthur,l[i].pages,l[i].price);
   }
   break;

  case 4:
   printf ("Enter book name : ");
   scanf ("%s",&bk_nm);
   for (i=0;i<3;i++)
   {
    if (bk_nm == l[i].bk_name)
     printf ("%s %s %d %f",l[i].bk_name,l[i].arthur,l[i].pages,l[i].price);
   }
   break;

  case 5:
   for (i=0;i<3;i++)
   {

   }
   break;
  case 6:
   exit (0);


 }
 return 0;
}

Sample Output

library working using struct

Read More..

compare two dates input by the user, using structure

0 comments

Problem

Write a program that compares two given dates. To store date use structure say date that contains three members namely date, month and year. If the dates are equal then display message as "Equal" otherwise "Unequal".

Solution - Code

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
struct dt_cmp
{
 int day;
 int month;
 int year;
};
main()
{
 struct dt_cmp s[2];
 int i;

 for (i=0;i<2;i++)
 {
  printf ("Enter day : ");
  scanf ("%d",&s[i].day);
  printf ("Enter month : ");
  scanf ("%d",&s[i].month);
  printf ("Enter year : ");
  scanf ("%d",&s[i].year);
 }

 if ( (s[0].day == s[1].day) && (s[0].month == s[1].month) && (s[0].year == s[1].year) )
  printf ("Equal\n");
 else
  printf ("Unequal\n");

 system("pause");
}

Sample Output

compare dates using structres

Read More..

search for a user (student) input data by using an array of structure, add user roll number, name, department, course, and year of joining by declaring a function name searchstudent(int)

0 comments

Problem

Create a structure to specify data on students given below:
  • Roll number
  • Name
  • Department
  • Course
  • Year of joining
Create above program by declaring an array of structure., input some value from user and then display those values. Also write a function:
void searchstudent (int roll_no);
This function will search a student record from that array whose Roll number is same as roll_no and display that record otherwise it displays record not found.

Solution - Code

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
struct student
{
 char name[30];
 int roll_no;
 char department[30];
 char course[30];
 int year;
};
void searchstudent (struct student *, int );

int main()
{

 struct student s[5];
 int i,rl,p;

 for (i=0;i<5;i++)
 {
  printf ("Enter name, ID, department, course, year : ");
  scanf("%s%d%s%s%d",&s[i].name,&s[i].roll_no,&s[i].department,&s[i].course,&s[i].year);
 }

 for (i=0;i<5;i++)
 {
  printf("And here is whhat you have entered\n\n");
  printf("Name = %s\n\nRoll No. = %d\n\nDepartment = %s\n\nCopurse = %s\n\nYear = %d\n\n",s[i].name,s[i].roll_no,s[i].department,s[i].course,s[i].year);
 }

 printf ("Enter number you want to search : ");
 scanf("%d",&rl);

 searchstudent (s ,rl);

 system("pause");
}
void searchstudent (struct student *p, int roll_no)
{
 int i,found = 0;
 for(i=0;i<5;i++)
 {
  if(p->roll_no == roll_no)
  {
   printf("record found");
   printf("Name = %s\n\nRoll No. = %d\n\nDepartment = %s\n\nCopurse = %s\n\nYear = %d\n\n",p->name,p->roll_no,p->department,p->course,p->year);
   found = 1;
  }
  if (found == 0)
   printf("Not found");
 }

}

Sample Output

search user roll# name using array of structure

Read More..

Display user input data by using an array of structure, add user roll number, name, department, course, and year of joining

0 comments

Problem

Create a structure to specify data on students given below:
  • Roll number
  • Name
  • Department
  • Course
  • Year of joining
Create above program by declaring an array of structure., input some value from user and then display those values.

Solution - Code

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
struct stud
{
 char name[30];
 int roll_no;
 char department[30];
 char course[30];
 int year;
}
int main()
{
 struct stud s[5];
 int i;

 for (i=0;i<5;i++)
 {
  printf ("Enter name, ID, department, course, year : ");
  scanf("%s%d%s%s%d",&s[i].name,&s[i].roll_no,&s[i].department,&s[i].course,&s[i].year);
}

 for (i=0;i<5;i++)
 {
  printf("And here is whhat you have entered\n\n");
  printf("Name = %s\n\nRoll No. = %d\n\nDepartment = %s\n\nCopurse = %s\n\nYear = %d\n\n",s[i].name,s[i].roll_no,s[i].department,s[i].course,s[i].year);
 }

 system("pause");
 return 0;
}

Sample Output

display user roll# name using array of structure

Read More..

write a program display user input data using structure, add user roll number, name, department, course, and year of joining

0 comments

Problem

Create a structure to specify data on students given below:
  • Roll number
  • Name
  • Department
  • Course
  • Year of joining
Create a variable of that structure, input some value from user and then display those values.

Solution - Code

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
struct stud
{
 char name[30];
 int roll_no;
 char department[30];
 char course[30];
 int year;
}
int main()
{
 struct stud s1;

 printf ("Enter name, ID, department, course, year : ");
 scanf("%s%d%s%s%d",&s1.name,&s1.roll_no,&s1.department,&s1.course,&s1.year);

 printf("And here is whhat you have entered\n");
 printf("Name = %s\n\nRoll No. = %d\n\nDepartment = %s\n\nCopurse = %s\n\nYear = %d\n\n",s1.name,s1.roll_no,s1.department,s1.course,s1.year);

 system("pause");
 return 0;
}

Sample Output


display user roll# name using struct

Read More..

Copyright 2017. All Rights Reserved. Privacy Policy / Terms And Conditions / Sitemap / Contact