#include <iostream.h> #include <stdio.h> using namespace std; int main() { string *a; a = new string[3]; a[0] = "Pingu Singh"; a[1] = "Chingu Singh"; a[2] = "Tingu Singh"; for (int i = 0; i <=2; i = i + 1) { cout << "Name[" << i << "] = " << a[i] << "\n"; } a = new string[5]; a[4] = "Last name"; for (int i = 0; i <=4; i = i + 1) { cout << "Name[" << i << "] = " << a[i] << "\n"; } delete[] a; cout << "\nPress ENTER to continue..." << endl; getchar(); return 0; }
Sunday, 29 April 2012
Program in C++ using Dynamic Arrays
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment