Answer the question
In order to leave comments, you need to log in
How to print array elements from x to y?
Hello! Started learning C++, started after Python. And I have a question whether it is possible to print a certain segment of an array in C ++. Here's what it looks like in Python.
arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(arr[2:4])
#Output:
#[3, 4]
char message[] = {"Hello!"};
Answer the question
In order to leave comments, you need to log in
int min;//это x
int max;//это y
for(int i=min;i<max;i++){
std::cout<<message[i];
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question