Assistance in my code.

I'm writing a program for my homework, and we suppose to use the switch case, and we are suppose to input number of any amendment and the out put will be a brief summary of the amendment. But for some reason after case number 4 which is the fourth amendment, it doesn't out put the case 5 through 27. Any help will be appreciated, I am a new to C++, so I might have made a big or simple mistake. Thanks. Here's the code::
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
  
#include "std_lib_facilities_4.h"

//Sites the summaries found on: http://totallyhistory.com/list-of-27-amendments-to-the-u-s-constitution/


int main()
{
	
	
	int number;
	
cout << "Please input a number (between 1 and 27) for which amendment you would like: ";
cin >> number;
	
	
	
if(number >= 1 && number <= 27)
{	
switch(number)
{
case 1:
cout << "Amendment 1 guarantees freedom of religion, speech, press, assembly, and petition." << endl;
break;
			case 2:
				cout << "Amendment 2 guarantees the people's right to own and bear arms for their defense." << endl;
				break;
			case 3: 
				cout << "Amendment 3 says that citizens cannot be forced to quarter soldiers during times of peace." << endl;
				break;
			case 4:
				cout << "4th Amendment: Citizens cannot be forced to subject themselves to seizure and search without a search warrant and probable cause." << endl;
				break;
			case 5:
				cout << "5th Amendment: Prohibits abuse of governmental authority in legal procedures. Establishes rules for indictment by eminent domain and grand jury. Guarantees the due process rights. Protects citizens from self-incrimination and double jeopardy." << endl;
				break;
			case 6:
				cout << "6th Amendment: Guarantees fair and speedy jury trial and the rights to know the accusation, the accuser, and to find counsel and witnesses." << endl;
				break;
			case 7:
				cout << "7th Amendment: Reserves individuals’ rights to jury trial depending on the civil case, and cases already examined by not be re-opened by another court." << endl;
				break;
			case 8: 
				cout << "8th Amendment: Forbids exorbitant bails and fines and punishment that is unusual or cruel." << endl;
				break;
			case 9:
				cout << "9th Amendment: Reserves the rights of citizens which are not specifically mentioned by the U.S. Constitution." << endl;
				break;
			case 10:
				cout << "10th Amendment: Reserves powers that are not given to the U.S. government under the Constitution, nor prohibited to a State of the U.S., to the people and the States." << endl;
				break;
			case 11:
				cout << "11th Amendment: State sovereign immunity. States are protected from suits by citizens living in another state or foreigners that do not reside within the state borders. Ratified: Feb. 7, 1795." << endl;
				break;
			case 12:
				cout << "12th Amendment: Modifies and clarifies the procedure for electing vice-presidents and presidents." << endl;
				break;
			case 13:
				cout << "13th Amendment: Except as punishment for criminal offense, forbids forced-slavery and involuntary servitude." << endl;
				break;
			case 14:
				cout << "14th Amendment: Details Equal Protection Clause, Due Process Clause, Citizenship Clause, and clauses dealing with the Confederacy and its officials." << endl;
				break;
			case 15:
				cout << "15th Amendment: Reserves citizens the suffrage rights regardless of their race, color, or previous slave status." << endl;
				break;
			case 16:
				cout << "16th Amendment: Reserves the U.S. government the right to tax income." << endl;
				break;
			case 17:
				cout << "17th Amendment: Establishes popular voting as the process under which senators are elected." << endl;
				break;
			case 18:
				cout << "18th Amendment: Denies the sale and consumption of alcohol." << endl;
				break;
			case 19:
				cout << "19th Amendment: Reserves women’s suffrage rights." << endl;
				break;
			case 20: 
				cout << "20th Amendment: also known as the “lame duck amendment,” establishes date of term starts for Congress (January 3) & the President (January 20)." << endl;
				break;
			case 21: 
				cout << "21st Amendment: Details the repeal of the Eighteenth Amendment. State laws over alcohol are to remain." << endl;
				break;
			case 22:
				cout << "22nd Amendment: Limit the terms that an individual can be elected as president (at most two terms). Individuals who have served over two years of someone else’s term may not be elected more than once." << endl;
				break;
			case 23:
				cout << "23rd Amendment: Reserves the right of citizens residing in the District of Columbia to vote for their own Electors for presidential elections." << endl;
				break;
			case 24:
				cout << "24th Amendment: citizens cannot be denied the suffrage rights for not paying a poll tax or any other taxes." << endl;
				break;
			case 25:
				cout  << "25th Amendment: establishes the procedures for a successor of a President." << endl;
				break;
			case 26:
				cout << "26th Amendment: Reserves the right for citizens 18 and older to vote." << endl;
				break;
			case 27:
				cout << "26th Amendment: Reserves the right for citizens 18 and older to vote." << endl;
				break;
				
			default:
				cout << "Error! Please enter a number between 1 and 27.";
				break;
		
		
		
		
		
		}
	
	}

	
	
	
	
	return 0;
	
You're missing the last curly brace to close out your main.

Also you're either gonna need to insert using namespace std; at the top, or add an std:: for every cout and every cin in your program. It runs perfectly fine on my end once I ironed those out.
Apparently the code left out the curly bracket. But originally my code has it in there.
And the std part is in the include file that we use for my school.
When ever i type number 5-27 it just outputs the number 5, 6 ,7 or etc, and not the summary of that amendment.
Also I'm using notepad++ to edit my work in. And use putty to compile stuff in.
I'm not familiar with the putty compiler so I won't be able to help you out on that end. But cplusplus.com links all its compileable code to cpp.sh

But I would recommend you get a copy of visual studios (2010 or above), codeblocks, or MinGW, I would say those may be better than what you're using, because I compiled it in VS2010 with std:: and iostream and it worked fine.
I had visual studio, but uninstalled it because to me putty was easier to manage.
Also our professor is going to use putty to test or work.
But thanks for your help.
Last edited on
"PuTTY is a utility for the Windows operating system that allows the user to remotely log into another machine using the Secure Shell (SSH) protocol"
You are probably using a g++ completer

But as for the code apart form the namespace error I don't see any thing wrong.
Topic archived. No new replies allowed.