Posts

Showing posts from May, 2017

Program to create , access structure

Image
#include<stdio.h> #include<string.h> typedef struct Student { int roll; char name[50]; int m[3]; int tot; float avg; char grade; }std; void insertdata(std [],int); void dispdata(std [],int); void topper(std [],int); void topper_each_sub(std [],int); void arrang_by_name(std [],int); int main() { std s[50]; int m; printf("Enter the total number of students :"); scanf("%d",&m); printf("\nEnter the records for %d students",m); insertdata(s,m); printf("\nRecords of %d students : ",m); dispdata(s,m); printf("\nTopper in the department : "); topper(s,m); printf("\nTopper in each subjects : "); topper_each_sub(s,m); printf("\nStudent's record in ascending order of name : "); arrang_by_name(s,m); dispdata(s,m); return 0; } void insertdata(std p[],int k) { int i,j; for(i=0;i<k;i++) { printf("\nInsert records for student %d : ",i+1); printf("

Different types of Abbreviation of a name

#include<stdio.h> void abbr1(char []); void abbr2(char []); void abbr3(char []); int main() { char str[50]; printf("Enter the name : "); gets(str); printf("\n Abbreviated for of the name is : "); abbr1(str); printf("\n Abbreviated for of the name is : "); abbr2(str); printf("\n Abbreviated for of the name is : "); abbr3(str); return 0; } void abbr1(char str[]) // input: Rajib Kumar Das ==> output: R.K.D { char abbr[15]; int i,j; abbr[0]=str[0]; for(i=1,j=1;str[i]!='\0';i++) { if(str[i]==' ' && str[i+1]!=' ') { abbr[j++]='.'; abbr[j++]=str[i+1]; } } abbr[j]='\0'; puts(abbr); } void abbr2(char str[]) // input: Rajib Kumar Das ==> output: R.K.Das { char abbr[15]; int i,j,t; abbr[0]=str[0]; for(i=1,j=1;str[i]!='\0';i++) { if(str[i]==' ' && str[i+1]!=' ') { t=i+1; abb