Purchase Solution

States Capitals Selection Program

Not what you're looking for?

Ask Custom Question

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!";

Purchase this Solution

Solution Summary

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

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 < ...

Purchase this Solution


Free BrainMass Quizzes
Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Basic Networking Questions

This quiz consists of some basic networking questions.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

C# variables and classes

This quiz contains questions about C# classes and variables.