answersLogoWhite

0


Best Answer

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;

}

}

User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: A program of c plus plus to accept the string and display the alternate characters in reverse order using pointer?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

C program pointers to pointers examples?

Pointer to Pointer is a double pointer, denoted by (**). Pointer stores the address of the variable and pointer to pointer stores the address of a pointer variable and syntax can be given as int **ptr2ptr;


CAN a word processor program read encrypted data?

No, if it is coded it would display only set of meaningless characters.


What is program counter?

Synonym for Instruction Pointer.


What is meant by an pointer in c program?

Pointer is like variable address the members in memory shell


How do you write a program that outputs a given characters in reverse?

write the javascript code to display the reverse no. of given no. (e.g. 247 reverse of 742)


What is the difference between stack pointer and program counter?

The stack pointer keeps track of the top of the stack used by the current thread. The program counter keeps track of the next instruction in a program. Both are registers and both store a memory address.


How do you write a c program to prints name?

Write a c program that reads your first name and surname when you enter them. Each part of your name should not be more than 12 characters. Finally, have the program display your full name.


What is the purpose of pointer in C?

the purpose of pointer in c for saving the memory space.,and reduce the length and complexity of the program


In C programming what is pointer?

Simply put, a pointer is a memory address. It "points" to data at that address. The Data Type of the pointer tells the program how to interpret the data at the address. For example, a character pointer will read the data at the address as a byte and interpret it as a character (like an ASCII character, for instance). A string pointer is just like a character pointer, except that it starts reading characters at the address and keeps going until it encounters a null (a data value of zero). The "string" of characters is interpreted as text. The available data types include just about anything you can imagine. Intrinsic types, structures, functions... in later versions of C, pointers can point to objects.


How do you start the display program in Linux from the command line?

the command "display" brings up the ImageMagick program.


What is the difference bw function pointer and function of pointer?

function pointer is a variable that hold the address of any function which declared in the program but function pointer is the array of the function that accept the run time size of the function.


What is null pointer assignment?

This error message means that somewhere in your program you have used a pointer-varible containing NULL-value. (Within an actual OS it with stop the program immediately, but in MS-DOS it doesn't.)