answersLogoWhite

0

/*Program to accept names of 5 students and display them in alphabetic order*/

#include<conio.h>

#include<stdio.h>

#include<string.h>

void main()

{

int i=0,j=0;

char frame[5],temp[5];

clrscr();

for(i=0;i<4;i++)

{

printf("\nEnter student[%d]string",i);

scanf("%s",fname[1]);

}

for(i=0;i<=4;i++)

{

for(j=i+1;j<=4;j++)

{

if(strcmp(fname[i],fname[i])>0)

{

strcpy(temp,fname[i]);

strcpy(fname[i],fname[i]);

strcpy(fname[j],temp);

}

}

}

printf("The names of the students in alphabetic order is:");

for(i=0;i<=4;i++)

{

printf("\n%s",fname[i]);

}

getch();

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Continue Learning about Engineering

Write a C program to accept roll numbers and names of 10 student using array and display the names?

Well, we're not going to do it for you.There's some example code and tutorials at http://www.cplusplus.com/doc/tutorial/ . It's for C++, but the code is simple enough that it shouldn't make a difference. Adapt that, and it should do exactly what you want.


Write a program which reads names of students and their telephones from a file and produce a linked list ordered in alphabetical order by the surname of the student?

write a program which reads names of students and their telephones from a file and produce a linked list ordered in alphabetical order by the surname of the student.


How is an array name interpretedwhen it is passed to a function?

An array is still an array, regardless of how you pass it into functions. It is still an array-type variable at the beginning of a function. However, the function itself may manipulate the array by "imploding" it into a string with a delimiter, using array values with only specific keys, and such.


Write code that prints the values stored in an array called names backwards?

In your main method: // Declare and initialize the array String names[] = {"Ana", "Bertha", "Cecilia", "Dora", "Emily"}; // Print backwards for (int i = names.length - 1; i &gt;= 0; i--) System.out.println(names[i]); If you want to print the individual texts backwards (like "Dora" --&gt; "aroD"), the StringBuffer class offers a method to do precisely that.


A C program using dynamic memory allocation to sort n names in ascending order?

Writing a C program that uses dynamic memory allocation to sort names in ascending order is a typical computer science assignment. To write this program, you must be in UNIX.

Related Questions

Write a C program to accept roll numbers and names of 10 student using array and display the names?

Well, we're not going to do it for you.There's some example code and tutorials at http://www.cplusplus.com/doc/tutorial/ . It's for C++, but the code is simple enough that it shouldn't make a difference. Adapt that, and it should do exactly what you want.


What is program style?

Program style refers to the way you write a program code. A good style is usually characterized by proper indentation, meaningful variable names, etc.


Write a program which reads names of students and their telephones from a file and produce a linked list ordered in alphabetical order by the surname of the student?

write a program which reads names of students and their telephones from a file and produce a linked list ordered in alphabetical order by the surname of the student.


How insert data into array in php?

There's several ways: 1) You can put square brackets on the end of a variable to create an array key inside that variable: $names['first'] = "john" $names['last'] = "smith" 2) You can use the array function: $names = array('first' =&gt; "john", 'last =&gt; "smith"); a lot of people set this function out like this: $names = array( 'first' =&gt; "john", 'last' =&gt; "smith" ); it makes it easier to read hope this helps


How is an array name interpretedwhen it is passed to a function?

An array is still an array, regardless of how you pass it into functions. It is still an array-type variable at the beginning of a function. However, the function itself may manipulate the array by "imploding" it into a string with a delimiter, using array values with only specific keys, and such.


Write code that prints the values stored in an array called names backwards?

In your main method: // Declare and initialize the array String names[] = {"Ana", "Bertha", "Cecilia", "Dora", "Emily"}; // Print backwards for (int i = names.length - 1; i &gt;= 0; i--) System.out.println(names[i]); If you want to print the individual texts backwards (like "Dora" --&gt; "aroD"), the StringBuffer class offers a method to do precisely that.


Is there an official translation for names of cities and names for streets in Hebrew do you write the Hebrew name for street I know but this program do not let me write it or the name and then street?

There is no official translation, but there is an official system in Israel of transliterating Hebrew letters


A C program using dynamic memory allocation to sort n names in ascending order?

Writing a C program that uses dynamic memory allocation to sort names in ascending order is a typical computer science assignment. To write this program, you must be in UNIX.


How do you write your own music on synthesia?

Synthesia is a training program, not a composing or recording program. It was originally called 'Piano Hero', but had to change names under a threat of lawsuit from Activision.


Accept ten names and print the given names in opposite order using array of pointers?

#include&lt;stdio.h&gt; #include&lt;string.h&gt; #include&lt;conio.h&gt; void main() { int i; char a[10]; printf("enter ten names one by one"); for(i=0;i&lt;=9;i++) { scanf("%s\n",a); } for(i=9;i&lt;=0;i--) { printf("names are %s\n"); } getch(); }


How can I write a code in Java that returns the number of names in a given array that end in either ie or y?

int getNumMatches(String[] names) { int numMatches = 0; for(String name:names) { if(name.endsWith("ie") name.endsWith("y")) { ++numMatches; } } return numMatches; }


What to write on my daughter's first year of dance for program book?

Write her name, age , place of the recital , what dance and to what music she performed, and the names of any students that accompanied her in the performance.