Problem Link: CodeChef: Practical coding for everyone
Learning course: Learn C++
My code
// Update the blanks below to print the first 3 characters of the String
// There is also a syntax error - try and fix it to debug the code
#include <bits/stdc++.h>
using namespace std;
int main() {
string var = "String";
cout << var[ 0 ]; //print the first 3 characters -their index is 0,1,2
cout << var[ 1 ];
cout << var[ 2 ];
return 0. //The; was missing.
This is a very common mistake!!!
}