Getting issue while solving this problem for assignment of C programming:
Need to create an app for college where there are 500 undergraduate students from which 250 are in School of Engineering (SOE) and 250 are in School of Science (SOE) , where suppose if a student belongs to Computer engineering (CE) batch 2020_21: supposed output needs too look like: SOEUNGCE0001 - SOEUNGCE0040
departments in school of engineering are:
- chemical engineering -CHE
- computer engineering -CE
- mechanical engineering- ME
- Environmental engineering -ENE
- Electrical Engineering - EE
and in school of science:
- Architecture -AR
- computer science-CS
- Biotechnology-BT
- Pharmacy-PH
I tried printing with switch case statements but it's wasn't working with strings. also the below program is having some issue i.e. it doesn't take some inputs. HELP ME SOLVE THIS.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct{
char name;
int roll_no;
char department;
char school;
}students;
int main()
{
students student;
//inputs
printf("Enter Name : " );
scanf("%s", &student.name);
printf("\nRoll Number : ");
scanf("%d", &student.roll_no);
printf("\nDepartment : ");
scanf("%s",&student.department);
printf("\nSchool : ");
scanf("%s",&student.school);
if (student.department == 'Chemical')
{
printf("Name : %s \t",student.name);
printf("\n%sUNG%s00%d", student.school, "CHE", student.roll_no);
}
return 0;
}