Basic string manipulation help

The user will enter a string with a length of at least 5 characters. Next, the user will input an integer representing the starting index of a new sub-string of the original. The final integer will be the length of the new sub-string.

You will then print out the new string taken from the original."

This is what i got so far

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <string>
using namespace std;

intmain(){
cin >> "";
string word = "";
cout << word;

int lenght_of_string = word.length;

system ("pause");
return 0;
}
Have you even tried to compile this?
You have several compile errors.

Line 5: You need a space between int and main.
Line 6: You can't do a cin to a quoted literal.
line 10: word.length is a function call you need () to indicate a function call.


Topic archived. No new replies allowed.