I'm quite new to C programming and I have an issue with how the code prompts the input. I need the inputs under the input statement to come one by one. Now the way the prompts are output is:
To add a new task enter the details below
Name of Task: Science
Then all the other inputs come as a group
Category of Task:
Information about task:
Due Date of Task:
Status of Task
TD = To-Do
IP = In Progress
CT = Completed Task
Enter Status:
But I want to it ask for the name of the task first and once I input that information, it should ask the category For example:
To add a new task enter the details below
Name of Task:
This is my code:
#include<stdio.h>
int main() {
char main_choice;
printf("Welcome to your Task Management System\n");
printf("What would you like to do today?\n A: Add New Task\n B: View Task \n C: Manage Tasks\n");
printf("\nEnter your choice:");
scanf("%c", &main_choice);
if (main_choice == 'A'){
char name;
char category;
char info;
char date;
char status;
printf("\nTo Add a new task enter the details below\n");
printf("Name of Task:");
scanf(" %c", &name);
printf("\nCategory of Task:");
scanf(" %c", &category);
printf("Information about task:");
scanf(" %c", &info);
printf("Due Date of Task:");
scanf(" %c", &date);
printf("Status of Task\nTD = To-Do\nIP = In Progress\nCT = Completed Task\n Enter Status:");
scanf(" %c", &status);
}
return 0;
}