0

How can I Move this partļæ¼ form ļæ¼C to C++

I want to know how to change the gets part ?? can someone help me ?? for (i = 0; i < N; i++) { printf("\n\n Employee %d\n\n", i + 1); printf(" Name (max 20 characters) : "); gets(employees[i].name); printf(" ID : "); employees[i].ID = 0; scanf("%d", &employees[i].ID); employees[i].salary = 200.0; do { printf(" Salary (200 to 4000) : "); scanf("%lf", &employees[i].salary); getchar(); } while (employees[i].salary < 200 || employees[i].salary > 4000); total_salary += employees[i].salary;ļæ¼ ļæ¼

16th Nov 2020, 2:37 PM
Aya Dmaidi
Aya Dmaidi - avatar
2 Answers
+ 2
I know a little of c++, but I think cin >> employees[i].name; Should work Wait for better answers šŸ¤—
16th Nov 2020, 3:08 PM
Davide
Davide - avatar
+ 3
Instead of gets use fgets function.. For charecter array of string input use, cin.getline() Instead of scanf, the cin works.. Remaining works i think.. For more show full code with trying these..
16th Nov 2020, 3:38 PM
Jayakrishna šŸ‡®šŸ‡³