Program will not show my cout statements
Nov 11, 2017 at 6:08pm UTC
I am writing a code that involves a class and my main.cpp file will not show my cout statements for the very beginning of the code. Is something out of place that I am not seeing?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
#include "stdafx.h"
#include <fstream>
#include <sstream>
#include <iostream>
#include "Contact.h"
using namespace std;
int main()
{
int option = 0;
do {
cout << "\nWhat would you like to do to yo?" << endl <<
"1) Load the entire list of contacts" << endl <<
"2) Find a contact" << endl <<
"3) Destroy a contact" << endl <<
"4) Destroy the entire list" << endl <<
"5) Exit" << endl <<
"Which option would you like (1-5)? " ;
string ans;
getline(cin, ans);
istringstream ss(ans);
ss >> option;
if (option < 1 || 5 < option) {
std::cout << "\nCan't understand your answer.\nPlease, retry." ;
continue ;
}
Contact manipulate;
if (option == 5) { break ; }
switch (option) {
case 1:
std::cout << "\nYour phrase is all lowercase is:\n"
<< manipulate.load();
break ;
case 2:
std::cout << "\nYour phrase entirely reversed is:\n"
<< manipulate.find();
break ;
case 3:
std::cout << "\nYour phrase sorted is:\n"
<< manipulate.destroy();
break ;
case 4:
std::cout << "\nYour phrase encrypted (I can keep a secret) is:\n"
<< manipulate.destroyAll;
break ;
}
} while (0 < option || option < 6);
system("pause" );
return 0;
}
Nov 11, 2017 at 6:37pm UTC
https://repl.it/OIFQ
Works perfectly fine, your std::cout messages in the switch block don't make sense though.
Topic archived. No new replies allowed.