Question

I've just finished typing my code in C, but I don't know how to draw a...

I've just finished typing my code in C, but I don't know how to draw a flowchart. Can somebody help me create a flow chart of this C program please?

#include <stdio.h>

int main(void){

char answer; // user's inputted single character

int score = 0; // initialize score to 0

printf("-----------------------------------\n");
printf("\tMood Self Assessment\n");
printf("-----------------------------------\n");

printf("This Mood Self-Assessment program can help you determine and understand how\nyou are feeling recently.");
printf("The user has to answer 3 questions honestly and\ntruthfully in order to have an accurate outcome.");
printf("You may now begin the test!\n\n");

int flag = 0; // set a flag to 0

do{ // do-while loops if the user enters other letters instead of a, b, c, d, and e.
printf("\n1. Do you feel bothered by feeling down or depressed lately?\n\n");
printf("a. Strongly disagree\nb. Disagree\nc. No opinion\nd. Agree\ne. Strongly Agree\n");
printf("\nYou answered: ");
scanf(" %c%*[^\n]", &answer); // scan a single character

switch (answer){
  
case 'a':
score = score + 5;
flag = 1; // set the flag to 1 if the user enters 'a'.
break;

case 'b':
score = score + 4;
flag = 1; // set the flag to 1 if the user enters 'b'.
break;

case 'c':
score = score + 3;
flag = 1; // set the flag to 1 if the user enters 'c'.
break;

case 'd':
score = score + 2;
flag = 1; // set the flag to 1 if the user enters 'd'.
break;

case 'e':
score = score + 1;
flag = 1; // set the flag to 1 if the user enters 'e'.
break;

default:
printf("\n----------------------------------------------");
printf("\nPlease enter a \"lower case\" letter from a to e\n");
printf("----------------------------------------------\n");

  
}
} while(flag == 0); // if the flag is 0, loop once the do-while. If it's 1, it continues on.

printf("Your answer: %c\n", answer);

flag = 0; // flag is reset to 0

do{
printf("\n2. Is social pressure affecting your daily life?\n\n");
printf("a. Strongly disagree\nb. Disagree\nc. No opinion\nd. Agree\ne. Strongly Agree\n");
printf("\nYou answered: ");
scanf(" %c%*[^\n]", &answer);

switch (answer){

case 'a':
score = score + 5;
flag = 1;
break;

case 'b':
score = score + 4;
flag = 1;
break;

case 'c':
score = score + 3;
flag = 1;
break;

case 'd':
score = score + 2;
flag = 1;
break;

case 'e':
score = score + 1;
flag = 1;
break;

default:
printf("\n----------------------------------------------");
printf("\nPlease enter a \"lower case\" letter from a to e\n");
printf("----------------------------------------------\n");

  
}
} while(flag == 0);

printf("Your answer: %c\n", answer);

flag = 0;

do{
printf("\n3. Are you unable to sleep due to situations happening in your daily life?\n\n");
printf("a. Strongly disagree\nb. Disagree\nc. No opinion\nd. Agree\ne. Strongly Agree\n");
printf("\nYou answered: ");
scanf(" %c%*[^\n]", &answer);

switch (answer){

case 'a':
score = score + 5;
flag = 1;
break;

case 'b':
score = score + 4;
flag = 1;
break;

case 'c':
score = score + 3;
flag = 1;
break;

case 'd':
score = score + 2;
flag = 1;
break;

case 'e':
score = score + 1;
flag = 1;
break;

default:
printf("\n----------------------------------------------");
printf("\nPlease enter a \"lower case\" letter from a to e\n");
printf("----------------------------------------------\n");

  
}
} while(flag == 0);

printf("Your answer: %c\n", answer);

printf("\n---------------------------");
printf("\nHow are you feeling lately?\n");
printf("---------------------------\n\n");

printf("Your score is %d/15\n", score);

if(score >= 12 && score <= 15) // interval of low to below average depression level
{
printf("\nLevel of Depression: low to below average\n\n");
printf("Thanks for taking time to complete the questions! The result shows that you are likely not depressed.\n");
printf("If there may be a bit of depression within you, don't worry because it will eventually go away.\n");
printf("You may retake the quiz anytime again to check how might you are feeling!! :)\n");
}
else if(score >= 8 && score <= 11) // interval of below average to average depression level
{
printf("\nLevel of Depression: below average to average\n\n");
printf("You are showing some kind of a depression. You are experiencing symptoms that are seen in anxiety. The feeling \n");
printf("of anxious from time to time is normal but if it is affecting your life, you should take some action against it.\n");
printf("You can seek moral support from your friends or your family, and you will be fine as time passes by.\n");
}
else if(score >= 4 && score <= 7) // interval of average to above average depression level
{
printf("\nLevel of Depression: average to above average\n\n");
printf("You are experiencing the symptoms of Depression. This means you are having the effect in your daily life both\n");
printf("physically and mentally. There will be some cases of anxiety or panic attack occuring throughout the time, which\n");
printf("it is important for you to overcome this harmful effect. You can seek help from Depression Helpline on 0800-111-757.\n");
}
else if(score >= 0 && score <= 3) // interval of average to high depression level
{
printf("\nLevel of Depression: above average to high\n\n");
printf("You have Crippling Depression. This is a serious case, and you MUST consult a Mental Health Professional\n");
printf("You may feel suicidal, or the need to hurt yourself. Please immediately reach out straight away for someone\n");
printf("who's trained for help. Call Depression Helpline on 0800-111-757.\n");
}

return 0;
}

Homework Answers

Answer #1

iam giving hand written solution

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
C Code! dictionary.c, start by downloading the boilerplate1 code from Blackboard. Read the code, then complete...
C Code! dictionary.c, start by downloading the boilerplate1 code from Blackboard. Read the code, then complete it at all places indicated by TODO. For this second assignment, you do not receive precise specifications. This is on purpose: in the software industry, you’ll find a lot of cases when you need to finish code started by others, while not being given precise instructions on how the code works or is supposed to work. The comments in the code will help you,...
C CODE PLZ! Need all TO DO sections finished thanks #include <stdio.h> int main(int argc, char...
C CODE PLZ! Need all TO DO sections finished thanks #include <stdio.h> int main(int argc, char **argv) { const int BUF_LEN = 128; char str[BUF_LEN]; int i; char c; int is_binary; int d, n; /* Get the user to enter a string */ printf("Please enter a string made of 0s and 1s, finishing the entry by pressing Enter.\n"); for (i=0; i<BUF_LEN-1; i++) { scanf("%c", &c); if (c == '\n') { break; } str[i] = c; } str[i] = '\0'; /*...
C - Language Write an expression that executes the loop while the user enters a number...
C - Language Write an expression that executes the loop while the user enters a number greater than or equal to 0. Note: These activities may test code with different test values. This activity will perform three tests, with user input of 9, 5, 2, -1, then with user input of 0, -17, then with user input of -1. Also note: If the submitted code has an infinite loop, the system will stop running the code after a few seconds,...
Here is my java code, I keep getting this error and I do not know how...
Here is my java code, I keep getting this error and I do not know how to fix it: PigLatin.java:3: error: class Main is public, should be declared in a file named Main.java public class Main { ^ import java.io.*; public class Main { private static BufferedReader buf = new BufferedReader( new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { String english = getString(); String translated = translate(english); System.out.println(translated); } private static String translate(String s) { String latin =...
Write a C/C++ program that performs the tasks described below. If there is just 1 command-line...
Write a C/C++ program that performs the tasks described below. If there is just 1 command-line argument and it is -hw you should simply print hello world and then exit(0). Otherwise, the program should provide a function named mm_alloc. This is the function prototype: void *mm_alloc(int num_bytes_to_allocate) mm_alloc function should obtain space for the user from a block which you obtain via mmap. You should obtain the block on the first invocation and the block size should be some number...
I don't know why this code wont build. I am using xcode and it has to...
I don't know why this code wont build. I am using xcode and it has to be in C++ // // NickSchmidtProj3>cpp // NickSchmidtProj3.Cpp // // Created by Nick Schmidt on 9/18/19. // Copyright © 2019 Nick Schmidt. All rights reserved. // #include <iostream> using namespace std; int () { //declare variables of integer type and set the tooth_pick_left is 23 int user_pick, computer_pick; int tooth_pick_left; //int user_tooth_pick cout << "let's play a game of "23"! \n"; //using do while...
"C language" Take this code and make the minor modification necessary to create a circular linked...
"C language" Take this code and make the minor modification necessary to create a circular linked list (Hint: Store a pointer to the first node in the next pointer of the last node.) Demonstrate that this is working by traversing the list until the first pointer is encountered 3 times. Next redefine the node structure to include a back pointer. This will enable your program to move from front to back and then from back to front. It is not...
I don't really need the answer since I have the answer. I just need to know...
I don't really need the answer since I have the answer. I just need to know how to solve them, like what buttons to click on the financial calculator. Please go based on the answer I have provided. Don't use r or c to explain. Only explain using n, i, pv, fv, pmt. 1.)You are 40 years old today and want to plan for retirement at age 65. You want to set aside an equal amount every year from now...
Hi, I need a program in C, where it will prompt a user for a math...
Hi, I need a program in C, where it will prompt a user for a math quiz, either easy or medium. If the user choses difficulty easy, it will prompt the user for how many questions they would like from 1-5. If the user enters medium it will prompt the user on how many questions they would like from 1-10. After those prompts are entered questions will be displayed using rand(), the questions must be multiple choice or division, aswell...
It is about C++linked list code. my assignment is making 1 function, in below circumstance,(some functions...
It is about C++linked list code. my assignment is making 1 function, in below circumstance,(some functions are suggested for easier procedure of making function.) void search_node(struct linked_list* list, int find_node_ value) (The function to make) This function finds the node from the list that value is same with find_node_value and count the order of the node. This function should print message “The order of (node_value) is (order).” and error message “Function search_node : There is no such node to search.”....