Any help appreciated!

closed account (G2zhRXSz)
Hey guys-
I wrote this code and am completely lost :( I can not use any arrays or vectors. Any help is greatly appreciated!!! My code is below, I just can't seem to figure out what I am doing wrong. Thank you!

It is supposed to look like this when run:
*****************************************************************
Welcome to the Rain Fall Program
You will enter the rainfall for the surrounding 3 counties and the month
it occurred (the Rain Fall Must be > 0).
Program Developed by: Koa
*****************************************************************

#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <string>
using namespace std;

//validate input (I had to make this function return a value, because I didn't know how to save the variable otherwise if the person first put 0')
void getRainFall(string county1, county2, county3, string month1, month2 month3, double &rainFall);
double county 1 = St Lucie County;
double county 2 = Martin County;
double county 3 = Palm Beach County;
void findGreatestRainFall (string month1, string month2, string month3, double rainfall_1, double rainfall_2 , double rainfall_3);
void findLeastRainFall (string month1, string month2, string month3,
double rainfall_1, double rainfall_2 , double rainfall_3);
void welcome();
double rainSum(double rain1, double rain2, double rain3);
{
string month1 = month1;
double inches = rainfall;
if (inches <= 0) {
while(inches <= 0) {
cout << "Invalid inches input.... inches must be greater than 0 \n";
cout << "Please enter the rainfall in inches:" ;
cin >> inches;
cout << "\n";
}

}
return inches;
}

void findGreatestRainFall (string month1, string month2, string month3, double rainfall_1, double rainfall_2 , double rainfall_3);
{
string month1 = month1;
string month2 = month2;
string month3 = month3;
double inches = rainfall_1;
double inches2 = rainfall_2;
double inches3 = rainfall_3;

if (inches < inches2 && inches < inches3) {

std::cout << "********* The least amount of inches is: " << inches << " *********";
cout << "\n";


} else if (inches2 < inches && inches2 < inches3 ) {

std::cout << "********* Your least amount of rainfall inches is: " << inches2 << " *********";
cout << "\n";


} else if (inches3 < inches && inches3 < inches2) {

std::cout << "********* Your least amount of rainfall inches is: " << inches3 << " *********";
cout << "\n";


} else if(inches == inches2 && inches == inches3) {
printf("We have a 3 way TIE!! All the amounts are equal....");
cout << "\n";

}
else if(inches == inches2) {
std::cout << "We have a TIE " << month1 << " and " << month2 << "Both amounts are equal...";
cout << "\n";


} else if(inches == inches3) {
std::cout << "We have a TIE " << month1 << " and " << month3 << " are equal!!!";
cout << "\n";



} else if(inches2 == inches3) {
std::cout << "We have a TIE " << month2 << " and " << month3 << " are equal!!!";
cout << "\n";


}
}

void findLeastRainFall (string m1, string m2, string m3,
double rf1, double rf2 , double rf3);
{
string month1 = month1;
string month2 = month2;
string month3 = month3;
double inches = rainfall_1;
double inches2 = rainfall_2;
double inches3 = rainfall_3;

if (inches < inches2 && inches < inches3) {
std::cout << "Yay! " << month1 << "is the least amount of rainfall";
cout << "\n";


} else if (inches2 < inches && inches2 < inches3 ) {

std::cout << "********* Your greatest number of rainfall inches is: " << inches2 << " *********";
cout << "\n";


} else if (inches3 < inches && inches3 < inches2) {

std::cout << "********* Your least amount of rainfall inches is: " << inches3 << " *********";
cout << "\n";


} else if(inches == inches2 && inches == inches3) {
printf("We have a 3 way TIE!! No greatest or least for this....");
cout << "\n";

}
else if(inches == inches2) {
std::cout << "We have a TIE " << month1 << " and " << month2 << " are equal...";
cout << "\n";

std::cout << "********* Your tied number of rainfall inches is: " << inches << " *********";
cout << "\n";


} else if(inches == inches3) {
std::cout << "We have a TIE " << month << " and " << month3 << " are equal...";
cout << "\n";

std::cout << "********* Your tied number of rainfall inches is: " << inches << " *********";
cout << "\n";


} else if(inches2 == inches3) {
std::cout << "We have a TIE " << month2 << " and " << month3 << " are equal....";
cout << "\n";

std::cout << "********* Your tied number of rainfall inches is: " << inches2 << " *********";
cout << "\n";


}
}

void welcome()
{
for(int i = 0; i < 45; i++) {
cout << "*";
}
cout << "\n";
cout << "Welcome to the Rainfall Program \n";
cout << "You will Enter the rainfall for the surrounding 3 counties and \n";
cout << "the month it occurred (the Rain Fall Must be > 0). \n";
cout << "\n";
cout << "Program Developed by: Koa \n";
{
cout << "*********************************************\n";
}
cout << "Please enter a real number for the rainfall in inches (the number must be > 0). \n";
for(int i = 0; i < 45; i++)

cout << "\n";

}

double rainSum(double rain1, double rain2, double rain3);
{
double sum = 0;
double inches = ti1;
double inches2 = ti2;
double inches3 = ti3;
return (inches + inches2 + inches3) / 3.0;
return sum;
}
int main()
{
//A. Declare and Initialize Variables to Store month’s(each county) Names(leasat), inches(greatest), and Average(sum)
string month = "Please enter the county's rainfall month: ";
string inches = "Please enter the month's rainfall in inches: ";

string month1, month2, month3;
double rainfall_1, rainfall_2, rainfall_3;
double sum;
string county1 = "St. Lucie County";
string county2 = "Martin County";
string county3 = "Palm Beach County";
//B. Call welcome() to display the program description
void welcome();

cout << month;
cin >> month1;
cout << "\n";

cout << inches;
cin >> rainfall_1;
//C. Call getRainFall() for St Lucie County
void getRainFall(county1, month1, rainfall_1);
cout << "\n";

cout << month;
//D. Call getRainFall() for Martin County
cin >> month2;
cout << "\n";

cout << inches;
cin >> rainfall_2;
//D. Call getRainFall() for Martin County

void getRainFall(county2, month2, rainfall_2);

cout << "\n";

cout << month;
cin >> month3;
cout << "\n";

cout << inches;
cin >> rainfall_3;
//E. Call getRainFall() for Palm Beach County
rainfall_3 = void getRainFall(month3, rainfall_3);

cout << "\n";

//F. Call findGreatestRainFall()
void findGreatestRainFall(month1, month2, month3, rainfall_1, rainfall_2, rainfall_3 );
cout << "\n";

//G. Call findLeastRainFall()
void findLeastRainFall(month1, month2, month3, rainfall_1, rainfall_2, rainfall_3 );
cout << "\n";

//H. Call rainSum() - Don't forget to capture the returned value
sum = double rainSum(rainfall_1, rainfall_2, rainfall_3);


cout << "Overall Average: " << avg;
cout << "\n";

return 0;

}
Topic archived. No new replies allowed.