answersLogoWhite

0

Refer to the first and last elements by index, and work towards the middle until the indices meet or pass each other, swapping the element values as you go.

User Avatar

Wiki User

11y ago

What else can I help you with?

Related Questions

What is the header for basic input or output in C Plus Plus?

For basic input and output in C++: #include


How do you alternate the input numbers using for loop in c plus plus?

Input a variable.


How do you clear input buffer in c plus plus?

cin.clear();


How do you enter a sentence as input in c plus plus?

Use the C++ getline() function from the standard library.


Input output function in c plus plus?

input is the << operator and output is the >> operator


A program of c plus plus to accept the string and display the alternate characters in reverse order using pointer?

The following program prints every second character of the input in reverse order. #include<iostream> #include<sstream> int main() { std::cout << "Input:\t"; std::string input = ""; std::getline (std::cin, input); if (input.size()) { std::cout << "Output:\t"; unsigned index = input.size() / 2 * 2; do { index -= 2; std::cout << input[index]; } while (index); std::cout << std::endl; } }


How do you check a user's text input in C plus plus?

Use an SLR parser algorithm.


Convert from infix to reverse Polish A plus B plus C plus D plus E?

A B plus C plus D plus E plusorA B C D E plus plus plus plusor variations.


Is cin an output identifier in c plus plus?

No. In C++ with <iostream>, cin is a prefedined class that represents stdin, so it is an input identifier.


Which function is used to remove all elements from a map in c plus plus?

map.clear()


What are file modes in c plus plus?

I guess you mean either input/output/inout/append or binary/text.


How do you write a c plus plus program to input the set of array elements and print it in reverse order?

Quick 'n' dirty example (use at own risk). Enter 10 numbers (range: 0-9) and print in reverse order. #include <stdio.h> int main{ BYTE element[10]; memset( &element[0], 10, 10 ); int i; for( i = 0; i < 10; ++i ) while( element[i] < 0 && element[i] > 9 ) cin >> element[i]; for( i = 10; i > 0; ) cout << element[--i]; return 0; };