Share
Explore BrainMass

States Capitals Selection Program

In C++

Write an if else programe that given a state, return its capital?

Maryland - Annapolis
Massachusetts - Boston
Michigan - Lansing
Minnesota - St. Paul
Mississippi - Jackson
Missouri - Jefferson City
Montana - Helena
Nebraska - Lincoln
Nevada - Carson City
New Hampshire - Concord
New Jersey - Trenton
New Mexico - Santa Fe
New York - Albany
if any other <<"is not known by this program!";

Solution Preview

#include <conio.h>
#include <string>
#include <iostream>
using namespace std;

const static int NAME_LEN = 200 ;

bool FindCapital (string& n, string& c) ;

int main()
{
string name ; // state name
string capital ;

cout << "Enter state name:";
// cin >> name ;

char szName [NAME_LEN + 1] ;
cin.getline( szName, NAME_LEN, 'n' );

for( char* p = szName; p < ...

Solution Summary

A C++ program is written that given a state, the program returns its capital.

$2.19