Please send questions to
st10@humboldt.edu .
/*----------------------------------------------------------------
Contract: main: void -> int
Purpose: playing with C strings and the standard string class
Examples: demo, so not really applicable
By: Sharon M. Tuttle
last modified: 12-7-05
-----------------------------------------------------------------*/
#include <iostream>
#include <string>
using namespace std;
int main()
{
const int MAX_LENGTH = 7;
string name, name3;
char another_name[MAX_LENGTH];
int amount;
cout << "how many things? ";
cin >> amount;
// can you declare an array using a changing variable?
double things[amount];
name = "Spam";
//another_name = "Cleese"; // cannot get this to work - try it!
cout << "names are: " << name
/*<< " and " << another_name*/ << endl;
for (int i=0; i<amount; i++)
{
things[i] = i * 2.5;
}
for (int i=0; i<amount; i++)
{
cout << things[i] << " ";
}
cout << endl;
return EXIT_SUCCESS;
}