Provinces of the philippines

Pages: 12
closed account (48T7M4Gy)
as i have said I am new to programming


BS! We read that 20 times every day from people who just want their homework done for them and don't make an effort. Most people are better than that fortunately and they get lots of help here.

So which part of the relevant section on getline() in the other thread you created don't you understand? Have you looked in the tutorial. Have you Google getline()? Where's your code?

Have you turned your computer on?
i already did that...

now... how can i edit the getline??
i mean how am i gonna put it in my code???
//This Program Will Gives You The Information Of The Different Provinces Of The Philippines.
#include<iostream>
#include<string>
using namespace std;
int main()
{
std::string Province;


std:: cout<< "Please Enter The Name Of The Province";
std:: cin>>Province;

if (Province == "Abra")
{
cout<< "Capital: Bangued"<<endl;
cout<< "Population: 241,160"<<endl;
cout<< "Area: 1,608.21 sq mi"<<endl;
cout<< "Density: 150/sq mi"<<endl;
cout<< "Founded: 9-March-17"<<endl;
cout<< "Division: Luzon"<<endl;
cout<< "Region: CAR"<<endl;
}
else if (Province == "Agusan Del Norte")
{
cout<< "Capital: Cabadbaran"<<endl;
cout<< "Population: 691,566"<<endl;
cout<< "Area: 1,369.45 sq mi"<<endl;
cout<< "Density: 490/sq mi"<<endl;
cout<< "Founded: 1-January-70"<<endl;
cout<< "Division: Mindanao"<<endl;
cout<< "Region: XIII"<<endl;
}
else if (Province == "Agusan Del Sur")
{
cout<< "Capital: Properidad"<<endl;
cout<< "Population: 700,653"<<endl;
cout<< "Area: 3,856.98 sq mi"<<endl;
cout<< "Density: 180/sq mi"<<endl;
cout<< "Founded: 1-January-70"<<endl;
cout<< "Division: Mindanao"<<endl;
cout<< "Region: XII"<<endl;
}
how am i gonna put it??
http://www.cplusplus.com/reference/string/string/getline/

This will teach you proper getline() placement. Look at the example and see where they placed it.
Last edited on
so... i'm going to do it in all of my codes??
getline() takes an input (cin) and a string (Province), so you should put it where your cin is.
closed account (48T7M4Gy)
cj02
so... i'm going to do it in all of my codes??
how am i gonna put it??


Try getting with the program. getline() replaces the cin >> etc once you use the right syntax. This has already been described to you a couple of times!!!

If you can't just take a few minutes to let this sink in instead of looking for a quick free fix then maybe just turn your computer off instead. The result for you will be the same and you'll save electricity. :(
okay okay...

i'm not looking for a free fix i'm just asking on how to do it properly...

thanks by the way...
closed account (48T7M4Gy)
What's wrong with the reference to getline personxd1 has posted above? It has a sample of how to use it that you can run and modify using the wheel symbol in the top right hand corner of the purple box. You can cut and paste into your program.

So what/where is the problem?

( I don't want to be rude but do you want us to chop your food up for you. :)
i'm just asking how and where am i going to put it.

if you don't want to help then don't...
closed account (48T7M4Gy)
i'm (sic) just asking how and where am i going to put it.
Don't encourage me to answer that one. You're definitely not going to feel comfortable with the answer I have in mind for that question. :[
( Magtulakan ito kung saan ang araw ay hindi lumiwanag )
Last edited on
closed account (E0p9LyTq)
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
// This Program Will Gives You The Information Of The Different Provinces Of The Philippines.
#include <iostream>
#include <string>

int main()
{
   std::cout << "Enter The Name Of The Province: ";
   std::string Province;
   std::getline(std::cin, Province);  // retrieves the entire line of input, not just the first word

   if (Province == "Abra")
   {
      std::cout << "Capital: Bangued\n";
      std::cout << "Population: 241,160\n";
      std::cout << "Area: 1,608.21 sq mi\n";
      std::cout << "Density: 150/sq mi\n";
      std::cout << "Founded: 9-March-17\n";
      std::cout << "Division: Luzon\n";
      std::cout << "Region: CAR\n";
   }
   else if (Province == "Agusan Del Norte")
   {
      std::cout << "Capital: Cabadbaran\n";
      std::cout << "Population: 691,566\n";
      std::cout << "Area: 1,369.45 sq mi\n";
      std::cout << "Density: 490/sq mi\n";
      std::cout << "Founded: 1-January-70\n";
      std::cout << "Division: Mindanao\n";
      std::cout << "Region: XIII\n";
   }
   else if (Province == "Agusan Del Sur")
   {
      std::cout << "Capital: Properidad\n";
      std::cout << "Population: 700,653\n";
      std::cout << "Area: 3,856.98 sq mi\n";
      std::cout << "Density: 180/sq mi\n";
      std::cout << "Founded: 1-January-70\n";
      std::cout << "Division: Mindanao\n";
      std::cout << "Region: XII\n";
   }
   else if (Province == "Aklan")
   {
      std::cout << "Capital: Kalibo\n";
      std::cout << "Population: 574,823\n";
      std::cout << "Area: 703.25 sq mi\n";
      std::cout << "Density: 830/sq mi\n";
      std::cout << "Founded: 8-November-56\n";
      std::cout << "Division: Visayas\n";
      std::cout << "Region: VI\n";
   }
   else if (Province == "Albay")
   {
      std::cout << "Capital: Legazpi\n";
      std::cout << "Population: 1,314,826\n";
      std::cout << "Area: 994.51 sq mi\n";
      std::cout << "Density: 1,300/sq mi\n";
      std::cout << "Founded: 3-April-74\n";
      std::cout << "Division: Luzon\n";
      std::cout << "Region: V\n";
   }
   else if (Province == "Antique")
   {
      std::cout << "Capital: San Jose\n";
      std::cout << "Population: 582,012\n";
      std::cout << "Area: 1,053.74 sq mi\n";
      std::cout << "Density: 540/sq mi\n";
      std::cout << "Founded: 10-March-17\n";
      std::cout << "Division: Visayas\n";
      std::cout << "Region: VI\n";
   }
   else if (Province == "Apayao")
   {
      std::cout << "Capital: Kabugao\n";
      std::cout << "Population: 119,184\n";
      std::cout << "Area: 1,704.00 sq mi\n";
      std::cout << "Density: 70/sq mi\n";
      std::cout << "Founded: 14-February-95\n";
      std::cout << "Division: Luzon\n";
      std::cout << "Region: CAR\n";
   }
   else if (Province == "Aurora")
   {
      std::cout << "Capital: Baler\n";
      std::cout << "Population: 214,336\n";
      std::cout << "Area: 1,215.19 sq mi\n";
      std::cout << "Density: 180/sq mi\n";
      std::cout << "Founded: 13-August-79\n";
      std::cout << "Division: Luzon\n";
      std::cout << "Region: III\n";
   }
   else if (Province == "Basilan")
   {
      std::cout << "Capital: Isabela\n";
      std::cout << "Population: 459,367\n";
      std::cout << "Area: 532.44 sq mi\n";
      std::cout << "Density: 850/sq mi\n";
      std::cout << "Founded: 27-December-73\n";
      std::cout << "Division: Mindanao\n";
      std::cout << "Region: ARMM\n";
   }
   else if (Province == "Bataan")
   {
      std::cout << "Capital: Balanga\n";
      std::cout << "Population: 760,650\n";
      std::cout << "Area: 530.11 sq mi\n";
      std::cout << "Density: 550/sq mi\n";
      std::cout << "Founded: 1754\n";
      std::cout << "Division: Luzon\n";
      std::cout << "Region: III\n";
   }
   else if (Province == "Batanes")
   {
      std::cout << "Capital: Basco\n";
      std::cout << "Population: 17,246\n";
      std::cout << "Area: 84.56 sq mi\n";
      std::cout << "Density: 200/sq mi\n";
      std::cout << "Founded: 26-June-1783\n";
      std::cout << "Division: Luzon\n";
      std::cout << "Region: II\n";
   }
   else if (Province == "Batangas")
   {
      std::cout << "Capital: Batangas City\n";
      std::cout << "Population: 2,694,335\n";
      std::cout << "Area: 1,204.53 sq mi\n";
      std::cout << "Density: 2,200/sq mi\n";
      std::cout << "Founded: 8-December-1581\n";
      std::cout << "Division: Luzon\n";
      std::cout << "Region: IV-A\n";
   }
   else if (Province == "Benguet")
   {
      std::cout << "Capital: La Trinidad\n";
      std::cout << "Population: 761,590\n";
      std::cout << "Area: 1,091.35 sq mi\n";
      std::cout << "Density: 750/sq mi\n";
      std::cout << "Founded: 16-June-1966\n";
      std::cout << "Division: Luzon\n";
      std::cout << "Region: CAR\n";
   }
   else if (Province == "Biliran")
   {
      std::cout << "Capital: Naval\n";
      std::cout << "Population: 171,612\n";
      std::cout << "Area: 206.95 sq mi\n";
      std::cout << "Density: 830/sq mi\n";
      std::cout << "Founded: 11-May-92\n";
      std::cout << "Division: Visayas\n";
      std::cout << "Region: VIII\n";
   }
   else if (Province == "Bohol")
   {
      std::cout << "Capital: Tagbiliran\n";
      std::cout << "Population: 1,313,560\n";
      std::cout << "Area: 1,861.38 sq mi\n";
      std::cout << "Density: 700/sq mi\n";
      std::cout << "Founded: 22-July-1854\n";
      std::cout << "Division: Visayas\n";
      std::cout << "Region: VII\n";
   }
   else if (Province == "Bukidnon")
   {
      std::cout << "Capital: Malaybalay\n";
      std::cout << "Population: 1,415,226\n";
      std::cout << "Area: 4,053.53 sq mi\n";
      std::cout << "Density: 340/sq mi\n";
      std::cout << "Founded: 1-September-14\n";
      std::cout << "Division: Mindanao\n";
      std::cout << "Region: X\n";
   }
   else if (Province == "Bulacan")
   {
      std::cout << "Capital: Malolos\n";
      std::cout << "Population: 3,292,071\n";
      std::cout << "Area: 1,079.58 sq mi\n";
      std::cout << "Density: 3,100/sq mi\n";
      std::cout << "Founded: 15-August-1578\n";
      std::cout << "Division: Luzon\n";
      std::cout << "Region: III\n";
   }
   else if (Province == "Cagayan")
   {
      std::cout << "Capital: Tuguegarao\n";
      std::cout << "Population: 1,199,320\n";
      std::cout << "Area: 3,589.11 sq mi\n";
      std::cout << "Density: 340/sq mi\n";
      std::cout << "Founded: 29-June-1583\n";
      std::cout << "Division: Luzon\n";
      std::cout << "Region: II\n";
   }
   else if (Province == "Camarines Norte")
   {
      std::cout << "Capital: Daet\n";
      std::cout << "Population: 583,313\n";
      std::cout << "Area: 895.78 sq mi\n";
      std::cout << "Density: 650/sq mi\n";
      std::cout << "Founded: 15-April-20\n";
      std::cout << "Division: Luzon\n";
      std::cout << "Region: V\n";
   }
   else
   {
      std::cout << "No Province Found!!!\n";
   }
}


Enter The Name Of The Province: Aklan
Capital: Kalibo
Population: 574,823
Area: 703.25 sq mi
Density: 830/sq mi
Founded: 8-November-56
Division: Visayas
Region: VI


Enter The Name Of The Province: alkan
No Province Found!!!
Topic archived. No new replies allowed.
Pages: 12