i hve got a problem with array of characters ;
PROBLEM:
There are 4 semesters in University. Store 3 names of student of lenght [15] and roll in each 4 semester?
Condition :-
1 .Semester 1
(a) Student Name(1)
(b ) Roll No of student
(a) Student Name (2)
(b ) Roll no of student
(a ) student Name (3)
(b ) Roll no of Student
.
.
.
4 .Semester 4
(a) Student Name
(b ) Roll No of student
INPUT =
1.Students Name of Length[15]
2.Roll no of students.
ERROR:
the compiler is asking the Name first time
than it is only asking the roll # .
OUTPUT
Enter the name hbk
Enter the roll # 3
Enter the name Enter the roll # (Not asking name )
Enter the name Enter the roll # (Not asking name )
Enter the name Enter the roll # (Not asking name )
---------------------------------------------------------------------------------------------
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
typedef struct STUDENT
{
char name[15];
int roll[3]
};
STUDENT bscs[3];
int i,j;
for( i=0 ; i<3 ; i++ )
{
for( j=0 ; j<3 ; j++ )
{
printf("\nENTER THE NAME PLEASE");
scanf("%s",&bscs[i].name[j]);
printf("ENTER THE ROLL #");
scanf("%f",&rawf);
}
}
getch();
}
ERROR:
the compiler is asking the Name first time
than it is only asking the roll # .
OUTPUT
Enter the name hbk
Enter the roll # 3
Enter the name Enter the roll # (Not asking name )
Enter the name Enter the roll # (Not asking name )
Enter the name Enter the roll # (Not asking name )
This post has been edited by wizarD.ubit: 19 August 2009 - 05:07 PM

New Topic/Question
Reply




MultiQuote






|