- 2

Please, make code, which will show us todays data in struct function at C programme.

https://code.sololearn.com/c3Mar6AbI6lh/?ref=app For example, we will write 23/4/2019 and it will show us that Today is 23 April 2019.

2nd Dec 2019, 10:38 AM
Elvin Namazov
8 odpowiedzi
+ 1
Are you allowed to use array? you can try this approach if you are allowed to use arrays // add this array const char* MONTHS[12] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; // and for printing you do this printf("Today is %d %s %d\n", tData.day, MONTHS[tData.month - 1], tData.year); Alternatively, you can also use `switch` to solve this.
2nd Dec 2019, 11:30 AM
Ipang
+ 1
Elvin, Try to add the array line in your main function. And call `printf` in main function as I had shown in my previous response. It's that simple, I'm very sure you can do this. Talk to me again after you make the update in your code, let me know how it goes, okay?
2nd Dec 2019, 2:33 PM
Ipang
2nd Dec 2019, 3:18 PM
Elvin Namazov
+ 1
I write your code like this, but there are some problems, can you look at this, and show me where is the problem
2nd Dec 2019, 3:20 PM
Elvin Namazov
+ 1
Oh, ok i understand, thank you🙂
2nd Dec 2019, 3:36 PM
Elvin Namazov
+ 1
You're welcome Elvin 👍
2nd Dec 2019, 3:38 PM
Ipang
0
Can you just make or write the ready form of this code. )
2nd Dec 2019, 12:26 PM
Elvin Namazov
0
Elvin, First, 👍 for not giving up. Now, about the code. I see you changed the specifier in your call to `scanf`. But it was not necessary, you can call `scanf` as you did before. scanf("%d/%d/%d", &tData.day, &tData.month, &tData.year); // Line 8 Just like this. Hopefully it works well by then : )
2nd Dec 2019, 3:26 PM
Ipang