Prompt/Input and code not executing.

Hello, folks I am working on a project for my C/C++ course and I ran into a roadblock. The professor wants us to have a splash screen, prompt for user input and display it on a output screen using the getline command.

My code executes, but the issue is that only int main executes (which is my splash screen) and the code for the input/output screen is never executed.
Please help!

#include <iostream>
#include <string> // included for the string class
#include <cstdlib> // included for the system clear screen function

using namespace std;

int main() // Code for splash screen
{

cout << " X X" << endl;
cout << " X X" << endl;
cout << " X X A L L" << endl;
cout << " XXXXXXX A A L L" << endl;
cout << " X X AAAAA L L" << endl;
cout << " X X A A L L" << endl;
cout << " X X A A LLLLLLLLL LLLLLLLLL" << endl;

cout << " OOO" << endl;
cout << " O O" << endl;
cout << " O O" << endl;
cout << " O O FFFFFFFFF" << endl;
cout << " O O F" << endl;
cout << " O O FFFFF" << endl;
cout << " O O F" << endl;
cout << " OOO F" << endl;

cout << " FFFFFFFFF" << endl;
cout << " F" << endl;
cout << " F A M M EEEEEEEEE" << endl;
cout << " FFFFF A A M M M M EE" << endl;
cout << " F AAAAA M M M M EEEEEEEEE" << endl;
cout << " F A A M M M M EE" << endl;
cout << " F A A M MM M EEEEEEEEE" << endl;

cout << " Game Distribution Center by Frank Edwards \n";
cout << " Press <ENTER> to Continue";
cin.get();
system("cls");
} // End of code for splash screen



int input_Screen()
{//Start of code for input screen






cout << " HALL OF FAME" << endl;
cout << endl;
cout << " GAME DISTRIBUTION CENTER" << endl;
cout << endl;
cout << " BY FRANK EDWARDS" << endl;
cout << endl;
cout << "Enter the Game's Publisher: " << flush;
string publisher = "No Data"; getline(cin, publisher);
cout << endl;
cout << "Enter the Game's Title: " << flush;
string title = "No Data"; getline(cin, title);
cout << endl;
cout << "Enter Projected Sales: " << flush;
string projected_Sales = "No Data"; getline (cin, projected_Sales);
cout << endl;
cout << "Enter the Platform: " << flush;
string platform = "No Data"; getline (cin, platform);
cout << endl;
cout << "Enter the Edition: " << flush;
string edition = "No Data"; getline (cin, edition);
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << endl;
cout << " Press <ENTER> to Continue" << endl;
cin.get();
system ("cls"); // End of code for input screen
}
int output_Screen(string publisher, string title, string projected_Sales)

{ // Start of code for output screen
cout << " HALL OF FAME" << endl;
cout << endl;
cout << " GAME DISTRIBUTION CENTER" << endl;
cout << endl;
cout << " BY FRANK EDWARDS" << endl;
cout << endl;
cout << "Publisher: " << publisher << endl;
cout << endl;
cout << "Title: " << title << endl;
cout << endl;
cout << "Projected Sales: " << projected_Sales << endl;
cout << endl;



cout << "# of Keys to Reserve: " << endl;

return 0;
}









You need to call the input_Screen()/output_Screen(...) functions within main(). In order to do so you need to either move the entire functions before main() or at least the prototypes:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 // prototypes:
int input_Screen();
int output_Screen(string publisher, string title, string projected_Sales);

int main() // Code for splash screen
{
...

cout << " Game Distribution Center by Frank Edwards \n";
cout << " Press <ENTER> to Continue";
cin.get();
system("cls");

input_Screen();
...
}
Topic archived. No new replies allowed.