C++ execution program Question
Hello everyone, my code runs well but i am not able to make the screen display when i enter in my words. Would anyone be able to tell me where i went wrong. Here is my code: #include <iostream> using namespace std; class String { private: char strval[101]; public: String() { strval[0] = '\0'; }; String(char s[]) { int i = 0; while (s[i] != '\0') { strval[i] = s[i]; i++; } strval[i] = '\0'; } void ToCstring(char s[]) { int i = 0; while (s[i] != '\0') { strval[i] = s[i]; i++; } strval[i] = '\0'; } int Width() { int i = 0; while (strval[i] != '\0') { i++; } return i; } bool EqualTo(String s) { if (Width() != s.Width()) { return false; } else { for (int i = 0; i < Width(); i++) { if (strval[i] != s.strval[i]) { return false; } } } return true; } bool LessThan(String s) { int width = Width(); if (s.Width() < width) { width = s.Width(); } for (int i = 0; i < width; i++) { if (strval[i] > s.strval[i]) { return false; } } if (Width() < s.Width()) { return true; } return true; } bool GreaterThan(String s) { int width = Width(); if (s.Width() < width) { width = s.Width(); } bool equal = true; for (int i = 0; i < width; i++) { if (strval[i] < s.strval[i]) { return false; } else if (strval[i] != s.strval[i]) { equal = false; } } if (equal && Width() < s.Width()) { return false; } return true; } void Read() { cin >> strval; } void Write() { cout << strval << endl; } }; int main() { const int b = 101; int x; cout << "Number of Words Inputed is: "; cin >> x; while (x < 0 || x > 100) { cout << "Input Number (Range between 1 - 100)" << endl; cout << "Enter Number of Words Inputed: "; cin >> x; } String s1[b]; for (int i = 0; i < x; i++) {