Funny characters

Why is it actually it becoming the funny characters? How can I actually, get rid of it?
#include<iostream>
#include<stack>
#include<string>

using namespace std;

int main()
{
std::stack<char> mystack;
char MyWords[20];

std::cout<<"Please insert any words in order to check the balance of the parenthesis\n";
std::cin>>MyWords;
std::cout<<"The character is about "<<(unsigned)strlen(MyWords);
std::cout<<"\n";

for (int i=0; i<=(unsigned)strlen(MyWords); i++)
mystack.push(i);
std::cout<<"Popping out all the elements....\n";
while(!mystack.empty())
{
std::cout<<mystack.top();
mystack.pop();
}
std::cout<<"\n";

int m;
cin>>m;
}



[code]
Put the code you need help with here.
[/code]
where it says "Put the code you need help with here." you should write your code. ¿what do you find confusing?


> Why is it actually it becoming the funny characters?i
ASCII codes from 0 to 31 are control characters.
Given that that is not what you wanted to do, maybe you should say what you wanted to do. (comment your code)
when you test the program, when I put back the character, let's say, I put in, C..It does not display C but rather some of the funny chars. How can I put back, 'C' char back to another, 'C', not another characters
Topic archived. No new replies allowed.