if/else statement issue......

Hello, I have a few issues with my code today but I'll start with this one. When I run this program it gives me an output, but always includes the "th" which is in the final else statement to the back of all the lines read. Did I print the if/else statement wrong?


Example:
Enter your invoice number 7
Enter day due 1
Invoice #7 is due on the 1stth of the month.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>

using namespace std;

/*
 * main entry point
 */
int main(int argc, char** argv) {
   int invoiceNumber;
   int dayDue;
   cout << "Enter invoice number ";
   cin >> invoiceNumber;
 << " of the month." << endl;
   return 0;
}  // end main 
Last edited on
Yes. You want to use if, else if, else if, else. The first if on line 16 isn't connected to the if/else chain on 18-23, and since none of those are true, the else on 23 is activated.
oh hahahaha, what a stooge, I knew that. Thank you for the 30 seconds it took you I'm sure. Stupid little mistakes........

WOW.
Topic archived. No new replies allowed.