Hi I need a c++ program for this
One stormy night, as Dionne worked diligently on her Computer Programming labs, a bolt of lightening struck the house. The power surge raced through her computer, causing it to emit a strange glow. A strange new program appeared on her computer called "psychic". Dionne told all her friends that this program was capable of predicting the future. If they wanted to use the program, for a small fee, they could download it from her web site.
Objective - To write a program that will predict the future
Method - 1. Use the main procedure to
Prompt the user for his/her lucky number. Use this number as input to the srand function found in cstdlib
Prompt the user for which life topic he wishes his predictions based. Based on the user's response call one of three functions. Suggestions are love, finance, and school, but you may use three of your own choosing. Use a nested if-else statement to control which function is called.
2. Each function will
Call the rand function
Use value generated by the rand function and modulo division as the selector expression in a switch statement.
The switch statement will print out the predictions.
Allow for five different predictions per function.
3. Prompt the user to see if they want another prediction. Keep executing the program until the user tells you to quit. Make sure that you code for all possible user inputs, including wrong ones.
Have fun!!
C++ CODE:
#include <iostream>
#include <cstdlib>
#include <string>
#include <ctime>
using namespace std;
void Input_choice();
void Finance_Status();
void health_Status();
void love_Status();
int main()
{
int INput_Lucky_no;
char x;
bool playAgain =true;
cout << "* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * *" << endl;
cout << "* *" << endl;
cout << "* Welcome to the Psychic Computer
Network. *" << endl;
cout << "* My name is David, and I will be your
psychic computer guide. *" << endl;
cout << "* *" << endl;
cout << "* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * *" << endl << endl;
cout << "Please enter your lucky number: ";
cin >> INput_Lucky_no;
srand(INput_Lucky_no);
cout << endl;
Input_choice();
do//do-while loop as in do you want to read another
prediction?
{
cout << "\n\nThank you for
using the psychic computer network.";
cout << "\nWould you like me to make another prediction? y
for yes or n for no." << endl << endl;
cout << "Enter here: ";
cin >> x;
if (x == 'y' || x == 'Y')
{
cout <<
endl << endl;
Input_choice();
}
else if (x == 'n' || x ==
'N')
{
playAgain =
false;
break;
}
else
cout <<
"\n " << x << " is not y, n ,Y or N. Please only enter
y, n, Y or N."; //let user know what he/she did wrong
playAgain = true;
} while (playAgain);
return 0;
}
void Input_choice (void)
{
char Input_choice;
bool userfails = true;
do
{
cout << "Please enter an \"F\" for my predictions on your
Financial Situation."<< endl;
cout << "Please enter an \"L\" for my predictions on your
Love Life." << endl;
cout << "Please enter an \"H\" for my predictions on your
Health." << endl;
cout << endl;
cout << "Enter here: \n";
cin >> Input_choice;
cout << "I am looking into my crystal ball." <<
endl;
cout << "- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -" << endl;
if (Input_choice == 'F' || Input_choice == 'f')
{
Finance_Status();
userfails =
false; //without this the loop will start over again
}
else if (Input_choice == 'L' ||
Input_choice == 'l')
{
love_Status();
userfails =
false;//without this the loop will start over again
}
else if (Input_choice == 'H' ||
Input_choice == 'h')
{
health_Status();
userfails =
false;//without this the loop will start over again
}
else
{
userfails =
true;//cant be too safe
}
}while (userfails);//repeat loop while user keeps
failing
}
void Finance_Status(void)
{
int x = rand() % 5 + 1;
switch (x)
{
case 1:
cout << "You will be very rich.";
break;
case 2:
cout << "Times are tough but you will find your way.";
break;
case 3:
cout << "Saving is the key to your success. ";
break;
case 4:
cout << "Invest your money and the profit will be great.
";
break;
case 5:
cout << "You will be very poor. ";
break;
}
}
void love_Status(void)
{
int x = rand() % 5 + 1;
switch (x)
{
case 1:
cout << "Be patient, you will find your perfect
match.";
break;
case 2:
cout << "Nobody likes you.";
break;
case 3:
cout << "You will have to choose between two.";
break;
case 4:
cout << "You will find love_Status very soon. ";
break;
case 5:
cout << "Your current partner is cheating on you.";
break;
}
}
void health_Status(void)
{
int x = rand() % 5 + 1;
switch (x)
{
case 1:
cout << "You will live a long and health_Statusy life";
break;
case 2:
cout << "You need to start going to the gym.";
break;
case 3:
cout << "Eat less junk food and start eating
health_Statusy.";
break;
case 4:
cout << "Your health_Status will begin to deter.";
break;
case 5:
cout << "You will die soon";
break;
}
}
SAMPLE OUTPUT:

Hi I need a c++ program for this One stormy night, as Dionne worked diligently on...
C++ Guessing game. Create a project titled Lab4_Guess with a single file titled guess.cpp Program the following game. The computer selects a random number between 1 and 100 and asks the user to guess the number. If the user guesses incorrectly, the computer advises to try larger or smaller number. The guessing repeats until the user guesses the number. The dialog should look as follows (user input is shown in bold): Guess a number between 1 and 100: 50 try...
Use Dev C++ for program and include all of the following. Im
lost.
Make sure the user enters a letter of R, P, or S and the
computer generates a number between 0-2 and changes that number to
a letter of R, P or S, using a switch. Make sure the user knows why
he/she has won or lost – print a message like “Paper covers Rock”
or “Scissors cuts Paper”.
Ask the user how many times he/she wants to...
I need help with a C++ assignment: Write a program containing the following: 1. Variable Definitions only as (DieRoll, Guess, cnt1, cnt2) followed by this statement: srand((unsigned int)time (NULL)); which will give the random number generator a random starting point. Note: srand and rand require the TIME.H (or iomanip) cnt1 and cnt2 will be used in Chapter 5 drop box as counters for loops. Do NOT create additional variables. Points will be taken off for any additional variable creation. 2....
This is a C++ question need to complete project 2. attached the completed simple version of the program below but need the updated version which is listed in the project 2 outline Project 2 Rock, Paper, Scissors Updated Take the solution to Lab 3 and make sure the user enters a letter of R, P, or S and the computer generates a number between 0-2 and changes that number to a letter of R, P or S, using a switch....
MUST BE PROCEDURAL CODE, DO NOT USE GLOBAL VARIABLES. Write a program in C++that generates random words from a training set as explained in the lectures on graphs. Do not hard-code the training set! Read it from a file. A suggested format for the input file: 6 a e m r s t 10 ate eat mate meet rate seat stream tame team tear Here are some suggestions for constants, array declarations, and helper functions #include <iostream> #include <fstream> #include...
I have a programming assignment for a introductory c++ class and I am really struggling writing this program. Below are the assignment requirements, I am unable to use vectors in stl and I keep getting a ton of compiling errors. Thank you chegg experts. You have really helped me out this semester. Your responses and code has cleared up so many issues ive had. Description The purpose of this challenge is to employ the use of basic functions and arrays....
C++ Program Int Main First Please Write one program that does the following: 1. 1. Ask the user for ten (10) grades, and store the data in an array. Compute the average of all the grades. Print the original ten grades and the average. a. Declare an integer array with the name of “grades” of size 10 in the main function. b. Create a function called “getGrades” that prompts the User for the grades and puts them in an integer array. i. The function will receive...
In C++: A. Write 3 functions that are called in the program. 1. Function readInput prompt user to enter an integer to store to the parameter. 2. Function isPerfectSquare take an integer parameter and checks whether it's a perfect square, that it's square root is an integer. 3. Function min3 return the mainimum value of the parameter values, it shouldn’t use any if statement to compare the parameters but call min2 to do the comparison. Extra Credit: Function printPrimeFactorization print...
I am struggling with a program in C++. it involves using a struct and a class to create meal arrays from a user. I've written my main okay. but the functions in the class are giving me issues with constructors deconstructors. Instructions A restaurant in the Milky way galaxy called “Green Alien” has several meals available on their electronic menu. For each food item in each meal, the menu lists the calories per gram and the number of grams per...
Assignment C++: Rock-Scissor-Paper & Tic-Tac-Toe i need you to write two different program for RSP and TTT: R-S-P Requirement: - write one program that mimics the Rock-Scissor-Paper game. This program will ask user to enter an input (out of R-S-P), and the computer will randomly pick one and print out the result (user wins / computer wins). - User's input along with computer's random pick will be encoded in the following format: -- user's rock: 10 -- user's scissor: 20...