WHY DATA TYPE INTEGER STORE TEXT

#include <iostream>
#include <string>

using namespace std;

int bank(string z)
{
int y;
int money[3];

for(int x = 0; x <= 2; x++){
cout << z << x + 1 << ". bank: ";
cin >> y;
money[x] = y;
}for(int x = 0; x <= 2; x++){
money[x];
cout << z << x + 1 << ". bank is " << money[x] << " dollars." << endl;
}
}

int main()
{
int y;
int money[3];

for(int x = 0; x <= 2; x++){
cout << "Enter the amount of money for your " << x + 1 << ". bank: ";
cin >> y;
money[x] = y;
}for(int x = 0; x <= 2; x++){
money[x];
cout << "Your amount of money in the " << x + 1 << ". bank is " << money[x] << " dollars." << endl;
}

bank("My "); // WHY DATA TYPE INTEGER STORE TEXT

return 0;
}
int bank(string z) <------- bank is a function that takes a string.

bank("My "); <--------------- you call bank, the function, with a string.

I am not sure exactly what you want to do, the code is a little strange, but that is why.

Topic archived. No new replies allowed.