Hi guys does any of you guys have this c++ program .
I need the program to input a string and accept a word number and
print this pattern.
Input) This is a message
Input)4
output) s
ssa
essag
message
essag
ssa
s
and if it is a even word for example golden then the output is
ld
olde
golden
olde
ld
Please can any of you guys write this program for me . 7 2107
On 21 Feb, 10:31, bigmovieb...@gmail.com wrote:
Hi guys does any of you guys have this c++ program .
I need the program to input a string and accept a word number and
print this pattern.
Input) This is a message
Input)4
output) * * * * * * * * * * * * *s
* * * * * * * * * * * * * * * * * ssa
* * * * * * * * * * * * * * * * *essag
* * * * * * * * * * * * * * * *message
* * * * * * * * * * * * * * * * *essag
* * * * * * * * * * * * * * * * * *ssa
* * * * * * * * * * * * * * * * * * *s
and if it is a even word for example golden then the output is
* * * * * * * * * * * * * * * * * *ld
* * * * * * * * * * * * * * * * *olde
* * * * * * * * * * * * * * * *golden
* * * * * * * * * * * * * * * * *olde
* * * * * * * * * * * * * * * * * *ld
Please can any of you guys write this program for me .
Sure, here you go:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
ostream& o = cout;
istream& i = cin;
typedef string s;
typedef vector<sv;
typedef s::iterator si;
typedef size_t t;
#define b_ begin()
#define e_ end()
int main() {
s s_; v v_; t n;
getline(i,s_);
i>>n;
while(--n) s_ = s(find(s_.b_, s_.e_,' ')+1,s_.e_);
s_ = s(s_.b_,find(s_.b_,s_.e_,' '));
t d = 0u;
t ll = s_.size();
for(t l = ((ll ^ 1u) & 1u) + 1; l <= ll;) {
si b = s_.b_ + (ll - l) / 2;
o<< s(b, b + l) << "\n";
l += 2 - d;
if(l >= ll) d = 4u;
}}
On Feb 21, 2:19 pm, "P. Lepin" <le...@ranselett.netwrote:
Sure, why not.
I see; so that's the way you want to be. Fine.
*cracks knuckles*
#include <stdio.h>
int main(int Z,char*_,int N){switch(Z){case 0:if(*_){putchar(
main(Z-1,"double f;switch{}0x53*DEBUG=1+9.%|!+./1256789:I_"
"abcdefghklmn""oprstuwy",*_));return main(Z,1+_,N);}return 0;
case -1:if(N==*_)return 36[_+Z] ;else return main(Z,_-Z,N);
}return main(Z-Z,"cd0D5{.5xd=GdU>dD=U5|=+Ed{.dD..1tll*+=%19b"
"*==*B5b0=Ul*+=%1l0=U1bB{G*b0uul}+=|95h3+Ul.D+5{xl 3xw;seif{w"
"3;f3 edo",N);}
That's C, mind you.
Jason
If your newer to c++, I would start with the word, then delete the the
end letters and display them above and below the original word until
the length of the string is 1 or 2. ja************@gmail.com <ja************@gmail.comwrote in
<f7**********************************@u69g2000hse. googlegroups.com>:
On Feb 21, 2:19 pm, "P. Lepin" <le...@ranselett.net>
wrote:
>Sure, why not.
I see; so that's the way you want to be. Fine.
*cracks knuckles*
#include <stdio.h>
int main(int Z,char*_,int N){switch(Z){case
0:if(*_){putchar( main(Z-1,"double
f;switch{}0x53*DEBUG=1+9.%|!+./1256789:I_"
"abcdefghklmn""oprstuwy",*_));return main(Z,1+_,N);}return
0;
case -1:if(N==*_)return 36[_+Z] ;else return
main(Z,_-Z,N); }return
main(Z-Z,"cd0D5{.5xd=GdU>dD=U5|=+Ed{.dD..1tll*+=%19b"
"*==*B5b0=Ul*+=%1l0=U1bB{G*b0uul}+=|95h3+Ul.D+
{xl3xw;seif{w"
"3;f3 edo",N);}
That's C, mind you.
Since we started switching languages, I could've whipped out
my Perl, and wouldn't THAT be horrible. But I won't. It's
off-topic here. :-)
(Translation: I'm chickening out!)
--
When all you have is a transformation engine, everything
looks like a tree.
On Feb 21, 3:20 pm, Triple-DES <fire13...@hotmail.comwrote:
On 21 Feb, 10:31, bigmovieb...@gmail.com wrote:
[Obvious homework problem deleted...]
Sure, here you go:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
ostream& o = cout;
istream& i = cin;
typedef string s;
typedef vector<sv;
typedef s::iterator si;
typedef size_t t;
#define b_ begin()
#define e_ end()
int main() {
s s_; v v_; t n;
getline(i,s_);
i>>n;
while(--n) s_ = s(find(s_.b_, s_.e_,' ')+1,s_.e_);
s_ = s(s_.b_,find(s_.b_,s_.e_,' '));
t d = 0u;
t ll = s_.size();
for(t l = ((ll ^ 1u) & 1u) + 1; l <= ll;) {
si b = s_.b_ + (ll - l) / 2;
o<< s(b, b + l) << "\n";
l += 2 - d;
if(l >= ll) d = 4u;
}}
Beautiful. It really pleases me to see that someone here has
finally learned how to respond to homework requests with some
originality.
--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: mike |
last post by:
Hello,
After trying to validate this page for a couple of days now I was
wondering if someone might be able to help me out. Below is a list of
snippets where I am having the errors.
1. Line 334,...
|
by: John Flynn |
last post by:
hi all
i'm going to be quick i have an assignment due which i have no idea how to
do. i work full time so i dont have the time to learn it and its due date
has crept up on me ..
As follows:...
|
by: xunling |
last post by:
i have a question about answering ..... this topic is "need help"
what do i have to write at te topic line, !after i have klicked the
"answer message" button
ive tried many possibilities,...
|
by: sk |
last post by:
I have an applicaton in which I collect data for different parameters
for a set of devices. The data are entered into a single table, each
set of name, value pairs time-stamped and associated with...
|
by: Timothy Shih |
last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I
wrote a simple function which takes in 2 buffers (one a byte buffer, one a
char buffer) and copies the contents of the byte...
|
by: Cheryl Langdon |
last post by:
Hello everyone,
This is my first attempt at getting help in this manner. Please
forgive me if this is an inappropriate request.
I suddenly find myself in urgent need of instruction on how to...
|
by: pamelafluente |
last post by:
I am still working with no success on that client/server
problem. I need your help. I will submit simplified versions
of my problem so we can see clearly what is going on.
My model:
A client...
|
by: skumar434 |
last post by:
i need to store the data from a data base in to structure
.............the problem is like this ....suppose there is a data base
which stores the sequence no and item type etc ...but i need only...
|
by: U S Contractors Offering Service A Non-profit |
last post by:
Brilliant technology helping those most in need Inbox
Reply
U S Contractors Offering Service A Non-profit
show details
10:37 pm (1 hour ago)
Brilliant technology helping those most in need ...
|
by: mike |
last post by:
I help manage a large web site, one that has over
600 html pages... It's a reference site for ham radio
folks and as an example, one page indexes over
1.8 gb of on-line PDF documents.
The site...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |