Write a program that presents seven proverbs

Assignment Help Business Management
Reference no: EM132260993

This the question

Using the table below, write a program that presents these seven proverbs one at a time and asks the user to evaluate them as true or false. The program should then tell the user how many questions were answered correctly, and display one of the following evaluations: Perfect (all seven answers correct), Excellent (5 or 6 correct), You might want to consider taking Psychology 101 (less than 5 correct).

Proverb                                                          Truth Value

The squeaky wheel gets the grease               True

Cry and you cry alone                                   True

Opposites attract                                            False

Spare the rod and spoil the child                   False

Actions speak louder than words                  True

Familiarity breeds contempt                          False

Marry in haste, repent at leisure                    True

You must utilize at least two switch statements and three functions (including main) in your solution.

One solution could look like this, yours might be different:

main

           switch statement to present each of the proverbs in order

           function call to func1 to process the answers, returning either true or false

           accumulate correct answer total

           function call to func2 to output the results, pass in total correct

func1

           ask user for answer, return true or false

func2

           switch statement to output results

                       7 correct == perfect

                       5 or 6 correct == excellent

                       < 5 correct == you should take Psychology 101

I have problem in my coding. I do not why I'm keep making a mistake. This is my code. Please someone explain to me why I'm doing wrong. Can someone explain to me step by step?

#include <iostream>

#include <string>

using namespace std;

bool provout (int i);

void finalout (int correct);

int main (void)

{

  string prov1 = "The squeaky wheel gets the grease";

  string prov2 = "Cry and you cry alone";

  string prov3 = "Opposites attract";

  string prov4 = "Spare the rod and spoil the child";

  string prov5 = "Actions speak louder than words";

  string prov6 = "Familiarity breeds contempt";

  string prov7 = "Marry in haste, repent at leisure";

  bool ans = 0;

  int total = 0;

  for (int i = 0; i < 7; i++)

  {

    switch (i)

    {

    case 0 :

       {

         cout << prov1 << endl;

         ans = provout (i);

         break;

       }

    case 1 :

       {

         cout << prov2 << endl;

         ans = provout (i);

         break;

       }

    case 2 :

      {

        cout << prov3 << endl;

        ans = provout (i);

        break;

      }

    case 3 :

      {

        cout << prov4 << endl;

        ans = provout (i);

        break;

      }

    case 4 :

      {

        cout << prov5 << endl;

        ans = provout (i);

        break;

      }

    case 5 :

      {

        cout << prov6 << endl;

        ans = provout (i);

        break;

      }

    case 6 :

      {

        cout << prov7 << endl;

        ans = provout (i);

        break;

       }

    }

  total = total + ans;

   }

finalout (total);

 

return 0;

}

bool provout (int i)

{

  bool ans = 0;

  bool ok = 0;

 

  cout << "Please answer 1 for True or 0 for False ";

  cin >> ans;

  switch (i)

  {

  case 0 :

  {

    if (ans == 1)

      ok = 1;

    else

      ok = 0;

    break;

  }

  case 1 :

   {

     if (ans == 1)

       ok = 1;

     else

       ok = 0;

  }

  case 2 :

    {

      if (ans == 0)

        ok = 1;

      else

        ok = 0;

      break;

    }

  case 3 :

    {

      if (ans == 0)

        ok = 1;

      else

        ok = 0;

      break;

    }

  case 4 :

    {

      if (ans == 1)

        ok = 1;

      else

        ok = 0;

      break;

    }

  case 5 :

    {

      if (ans == 0)

        ok = 1;

      else

        ok = 0;

      break;

    }

  case 6 :

    {

      if (ans == 1)

        ok = 1;

    }

  }

return ok;

}

void finalout (int correct)

{

  switch (correct)

  {

  case 7 :

    {

      cout << "Excellent!n";

      break;

    }

  }

}

Reference no: EM132260993

Questions Cloud

Determine which number is the smallest : Determine which number is the smallest. Print that number along with some descriptive text to inform the user of what is being printed to the screen.
Risk stratification-patient engagement and outreach : What is the role of EHRs, registries, risk stratification, patient engagement and outreach, care coordination and management, analytics,
Please write c++ program that reads : Please write C++ program that reads a local election result file (called "votes.txt"):
The purpose of the negotiation process is simple : “Let me be one of fifteen men at a table, and I will have my way” was stated by. The purpose of the negotiation process is simple.
Write a program that presents seven proverbs : Using the table below, write a program that presents these seven proverbs one at a time and asks the user to evaluate them as true or false.
Decision-making methodology in business : GIIM 619 Marketing Management - Concordia University - An effective problem-solving/decision-making methodology in business incorporates
What are the basic data definition commands : What are some of the things you can accomplish with a data definition command?
Drawback of warehouses consolidation in distribution network : What is the problem addressed in this paper? What are the benefits and drawbacks of warehouses consolidation in a distribution network?
Output the repayment schedule : A $40,000 , 6 month, 5% annual rate car loan is obtained on June 1. Output the repayment schedule with

Reviews

Write a Review

Business Management Questions & Answers

  Caselet on michael porter’s value chain management

The assignment in management is a two part assignment dealing 1.Theory of function of management. 2. Operations and Controlling.

  Mountain man brewing company

Mountain Man Brewing, a family owned business where Chris Prangel, the son of the president joins. Due to increase in the preference for light beer drinkers, Chris Prangel wants to introduce light beer version in Mountain Man. An analysis into the la..

  Mountain man brewing company

Mountain Man Brewing, a family owned business where Chris Prangel, the son of the president joins. An analysis into the launch of Mountain Man Light over the present Mountain Man Lager.

  Analysis of the case using the doing ethics technique

Analysis of the case using the Doing Ethics Technique (DET). Analysis of the ethical issue(s) from the perspective of an ICT professional, using the ACS Code of  Conduct and properly relating clauses from the ACS Code of Conduct to the ethical issue.

  Affiliations and partnerships

Affiliations and partnerships are frequently used to reach a larger local audience? Which options stand to avail for the Hotel manager and what problems do these pose.

  Innovation-friendly regulations

What influence (if any) can organizations exercise to encourage ‘innovation-friendly' regulations?

  Effect of regional and corporate cultural issues

Present your findings as a group powerpoint with an audio file. In addition individually write up your own conclusions as to the effects of regional cultural issues on the corporate organisational culture of this multinational company as it conducts ..

  Structure of business plan

This assignment shows a structure of business plan. The task is to write a business plane about a Diet Shop.

  Identify the purposes of different types of organisations

Identify the purposes of different types of organisations.

  Entrepreneur case study for analysis

Entrepreneur Case Study for Analysis. Analyze Robin Wolaner's suitability to be an entrepreneur

  Forecasting and business analysis

This problem requires you to apply your cross-sectional analysis skills to a real cross-sectional data set with the goal of answering a specific research question.

  Educational instructional leadership

Prepare a major handout on the key principles of instructional leadership

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd