0
Whay '<'signed /unsigned mismatch error??
stack <char>stack1; string my_string="hello"; for (int i =0; i< my_string.length(); i++) { stack1.push(my_string[i]); }
4 Answers
+ 2
I compiled and ran this that worked perfectly:
#include <iostream>
#include <stack>
using namespace std;
int main() {
stack <char>stack1;
string my_string = "hello";
for (int i = 0; i < my_string.length(); i++) {
stack1.push(my_string[i]);
}
return 0;
}
+ 1
Change the int to size_t?
0
@John Wells
may be my compiler it dosn't work
0
Interface says size_type, which is usually size_t.