#Why is it when I add an input, no value comes out?

5 messages · Page 1 of 1 (latest)

frail tiger
#

Provide code.

glad valve
#

@trail plume

trail plume
#

sorry sorry I’m trying to code snippet it but idk how to send it?? I can send the file for the code

#

**#include <iostream>
#include <string>
#include "WashYourHands.hpp" // Include the header file

int main() {
std::string choice;
int first_parameter;
int second_parameter;

std::cout << "Have you recorded your daily hand washing routine?: ";
std::cin >> choice;

if (choice == "Yes") {
    std::cout << "Okay thank you for your protection, please input the following information:\n" << "\nHow often do you wash your hands per day?: ";
    std::cin >> first_parameter;

    if (first_parameter <= 2) {
        std::cout << "You're in urgent need of improvement.\n" << "Despite this, please state how many months have you kept this up for?: ";
        std::cin >> second_parameter;

        std::string result = Wash_Hands(first_parameter, second_parameter);
        std::cout << result;

        // These blocks are independent, not nested
        if (first_parameter <= 5) {
            std::cout << "Okay not bad..\n" << "How many months have you kept this up for?: ";
            std::cin >> second_parameter;
            std::cout << Wash_Hands(first_parameter, second_parameter);
        }
        if (first_parameter > 5) {
            std::cout << "That's great! Average too, well done.\n" << "And how many months have you kept this up for?: ";
            std::cin >> second_parameter;
            std::cout << Wash_Hands(first_parameter, second_parameter);
        }
    } else if (first_parameter <= 0) {
        std::cout << "Invalid Input, Try again.." << "\n";
    }
}
else if (choice == "No") {
    std::cout << "Please enroll and participate in the NHS program or you will be fined, we will know if you lie." << "\n";
}

}**

glad valve
#
#include <iostream>
#include <string>
#include "WashYourHands.hpp" // Include the header file

int main() {
    std::string choice;
    int first_parameter;
    int second_parameter;

    std::cout << "Have you recorded your daily hand washing routine?: ";
    std::cin >> choice;

    if (choice == "Yes") {
        std::cout << "Okay thank you for your protection, please input the following information:\n" << "\nHow often do you wash your hands per day?: ";
        std::cin >> first_parameter;

        if (first_parameter <= 2) {
            std::cout << "You're in urgent need of improvement.\n" << "Despite this, please state how many months have you kept this up for?: ";
            std::cin >> second_parameter;

            std::string result = Wash_Hands(first_parameter, second_parameter);
            std::cout << result;

            // These blocks are independent, not nested
            if (first_parameter <= 5) {
                std::cout << "Okay not bad..\n" << "How many months have you kept this up for?: ";
                std::cin >> second_parameter;
                std::cout << Wash_Hands(first_parameter, second_parameter);
            }
            if (first_parameter > 5) {
                std::cout << "That's great! Average too, well done.\n" << "And how many months have you kept this up for?: ";
                std::cin >> second_parameter;
                std::cout << Wash_Hands(first_parameter, second_parameter);
            }
        } else if (first_parameter <= 0) {
            std::cout << "Invalid Input, Try again.." << "\n";
        }
    }
    else if (choice == "No") {
        std::cout << "Please enroll and participate in the NHS program or you will be fined, we will know if you lie." << "\n";
    }
}