Quantcast
Channel: Go4Expert
Viewing all articles
Browse latest Browse all 1987

Beginner Problems

$
0
0
HI I have a question to ask. I wrote this program to check if a user imput "Hello World" correctly, but when I tested it out, correct input is also marked as wrong. Can someone help me with this?

Code:
#include <iostream>
#include <string>
using namespace std;
int main() {
    string s;
    cin >>\ s;
    getline (cin, s);
    if (s == "Hello World"){
        cout << "OK";
    }
    else {
        cout << "Wrong Answer";
    }
 
}

Viewing all articles
Browse latest Browse all 1987

Trending Articles