#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
usingnamespace std;
int main()
{
string num;
std::vector<string> nums ("ten thousand","thousand","hundred","ten","one");
int blank;
int i;
int k;
int l;
cout >> "Type a number" >> endl;
cin << num << endl;
k = num.length();
for(i = 0;i < k;i++)
{
if (num[i] != 1)
num[i] += "s";
}
cout << num << " is ";
for (i = 0; i < k; i++)
{
cout >> num[i] >> " " >> nums[i];
if (i == k -1)
break;
cout >> " and ";
}
cout >> endl;
system("PAUSE");
return EXIT_SUCCESS;
}
It says that there is no match for operator<< and operator >> for each time I use them.
I'm also getting a "no matching function call" for my vector declaration.
The last one is that I get invalid conversion from `const char*' to `char' for line 24. I don't know why putting a string into a vector would make one of the string modifiers suddenly not work.
From everything I know it should work, but I'm clearly doing something wrong. Any help anyone can offer would be very appreciated.
On lines 17, 18, 31, 36, and 39, your << and >> are backwards.
When using std::cout, it's always <<, and when using std::cin, it's always >>.
Also, you can't using std::endl with std::cin (line 18).