989


// Fig. 4_12: fig04_12.cpp

// Treating character arrays as strings

#include <iostream.h>

int main()

{

char string1[ 20 ], string2[] = "string literal";

cout << "Enter a string: ";

cin >> string1;

cout << "string1 is: " << string1

<< "\nstring2 is: " << string2

<< "string1 with spaces between characters is:\n";

for ( int i = 0; string1[ i ] != '\0'; i++ )

cout << string1[ i ] << ' ';

cin >> string1; // reads "there"

cout << "\nstring1 is: " << string1 << endl;

cout << endl;

return 0;

}

0x08 graphic

Enter a string: Hej tam

string1 is: Hej

string2 is: string literal

string1 with spaces between characters is:

H e j

string1 is: tam



Wyszukiwarka

Podobne podstrony:
989
glaskologia wydawnictwo 989 demo
989
989
989
989
989
989
Onkyo 989 DSP Enlarged
989
Onkyo 989 fan Japan
waltze 989 p
Wierszyki 989 1020
marche 989 p
Dz U 2016 poz 989

więcej podobnych podstron