Re: Please solve this question
On Sep 29, 4:15 am, Jeff Schwab <j...@schwabcenter.com> wrote:
reepakmajhi....@gmail.com wrote:
Write a c++ program to display the following?
# # # # #
K V Jharsuguda
# # # # #
#include <algorithm>
#include <iostream>
#include <iterator>
#include <sstream>
int main() {
std::istringstream input_stream(
"23 20 20 20 20 20 20 20 20 20 20 20 23 20 20 20"
"20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20"
"20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 20"
"20 23 0a 0a 20 20 20 20 20 20 20 20 20 20 4b 20"
"56 20 4a 68 61 72 73 75 67 75 64 61 0a 0a 23 20"
"20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20"
"20 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20"
"20 20 23 20 20 20 20 20 20 20 20 20 20 20 23 0a" );
input_stream.flags(std::ios::hex | std::ios::skipws);
copy(
std::istream_iterator<unsigned>( input_stream ),
std::istream_iterator<unsigned>( ),
std::ostream_iterator<char>( std::cout ));
return 0;
}
Did you actually try it? All you're doing is outputting your
string literal.
The obvious answer is something like:
std::cout
<< "# # # # #\n"
" K V Jharsuguda\n"
"# # # # #"
<< std::endl ;
But the answer is so obvious I suspect that tbe original poster
has some other additional requirements which he's chosen to hide
from us.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34