Thursday, October 20, 2016

String of Arrays in C++

Here is a sample program that I wrote a long time ago to show how to display a series of names of countries around the world using two dimensional array, strings and character in C++. The code is very short and easy to understand.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.


Program Listing

#include <iostream>

using namespace std;


int main()

{

char Country[6][15] = { "America", "Japan", "Zimbabwe",

                     "Sri Lanka", "Philippines",
                      "El Salvador" };

cout << "\t\t ARRAY OF STRINGS 1.0";
cout << "\n";
cout << "\n\tCreated By: Mr. Jake R. Pomperada, MAED-IT";
cout << "\n\nLIST OF COUNTRY NAMES";
    cout << "\n\n";
for(int i = 0; i < 6; ++i)

cout << "\nCountry " << i + 1 << ": " << Country[i];



cout << "\n\n";

return 0;

}

No comments:

Post a Comment