#include <iostream>using namespace std; int SoS(string str){ int i,sum=0,n; n=str.len(); for(i=0;i<n;i++) { putchar (tolower(str[i])); sum=sum+int(str[i]); } return sum;} int main() { string x,y; cin>> x>> y; int a,b; a=SoS(x); b=SoS(y); if(a==b) return 0; else if(a<=b) return -1; else return 1;}
Standard input is empty
prog.cpp: In function ‘int SoS(std::__cxx11::string)’: prog.cpp:6:9: error: ‘std::__cxx11::string {aka class std::__cxx11::basic_string<char>}’ has no member named ‘len’ n=str.len(); ^~~
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!