Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //2 big
- #include<stdio.h>
- struct employee {
- char name[30], surname[50];
- int age;
- float salary;
- };
- //1.1
- struct employee a,b;
- //1.2
- struct employee a = { "John","Smith",30,20,000 };
- struct employee b = { "Miranda","Brook",25,18,000 };
- //1.3
- #include<string.h>
- int main(){
- struct employee c;
- strcpy(c.name,a.name);
- strcpy(c.surname,a.surname);
- c.age=a.age;
- c.salary=a.salary;
- strcpy(a.name,b.name);
- strcpy(a.surname,b.surname);
- a.age=b.age;
- a.salary=b.salary;
- strcpy(b.name,c.name);
- strcpy(b.surname,c.surname);
- b.age=c.age;
- b.salary=c.salary;
- printf("%s %s %d %.3f",a.name,a.surname,a.age,a.salary);
- printf("\n%s %s %d %.3f",b.name,b.surname,b.age,b.salary);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement