473,803 Members | 4,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A c++ Program for Valentines day

Hey guys,

I know this is silly, but I just wanted to take some break from work. I
was just wodering if its possible to write a c++ program that can print
"iloveyou" in shape of 'heart' when executed. The impotant thing is
that, the program should not show any kind of words related to it, i
mean the program should not be understandable at the very first sight
the user goes through the code. It will be gr8 if something more
creative is achieved out of this idea. Think about it. Let me know if
its possible to make a code that can interact with user and print the
results for just one particular kind of input, and print it in a
beautiful way. I am not good enough in c++ to do that, so i was just
wondering someone can help me out with it. Thank you.

sandy

Feb 6 '06 #1
9 7880

"sandy" <sa************ ***@gmail.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hey guys,

I know this is silly, but I just wanted to take some break from work. I
was just wodering if its possible to write a c++ program that can print
"iloveyou" in shape of 'heart' when executed.
Certainly.
The impotant thing is
Don't say that on Valentine's Day. :-)
that, the program should not show any kind of words related to it, i
mean the program should not be understandable at the very first sight
the user goes through the code. It will be gr8 if something more
creative is achieved out of this idea. Think about it. Let me know if
its possible to make a code that can interact with user and print the
results for just one particular kind of input, and print it in a
beautiful way. I am not good enough in c++ to do that, so i was just
wondering someone can help me out with it. Thank you.


Get some graph paper, and draw the characters (perhaps asterisks) of
the output. After that it should be simple to write some loops to
output various character sequences. If you want to further obfuscate
the source, put random amounts of it in separate functions.

-Mike
Feb 7 '06 #2
In article <mD************ ******@newsread 2.news.pas.eart hlink.net>,
"Mike Wahler" <mk******@mkwah ler.net> wrote:
"sandy" <sa************ ***@gmail.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hey guys,

I know this is silly, but I just wanted to take some break from work. I
was just wodering if its possible to write a c++ program that can print
"iloveyou" in shape of 'heart' when executed.


Certainly.
The impotant thing is


Don't say that on Valentine's Day. :-)
that, the program should not show any kind of words related to it, i
mean the program should not be understandable at the very first sight
the user goes through the code. It will be gr8 if something more
creative is achieved out of this idea. Think about it. Let me know if
its possible to make a code that can interact with user and print the
results for just one particular kind of input, and print it in a
beautiful way. I am not good enough in c++ to do that, so i was just
wondering someone can help me out with it. Thank you.


Get some graph paper, and draw the characters (perhaps asterisks) of
the output. After that it should be simple to write some loops to
output various character sequences. If you want to further obfuscate
the source, put random amounts of it in separate functions.


You could also build the "i love you" string from ascii values or
individual chars that are distributed in the code.

--
Magic depends on tradition and belief. It does not welcome observation,
nor does it profit by experiment. On the other hand, science is based
on experience; it is open to correction by observation and experiment.
Feb 7 '06 #3
sandy wrote:
Hey guys,

I know this is silly, but I just wanted to take some break from work. I
was just wodering if its possible to write a c++ program that can print
"iloveyou" in shape of 'heart' when executed. The impotant thing is
that, the program should not show any kind of words related to it, i
mean the program should not be understandable at the very first sight
the user goes through the code. It will be gr8 if something more
creative is achieved out of this idea. Think about it. Let me know if
its possible to make a code that can interact with user and print the
results for just one particular kind of input, and print it in a
beautiful way. I am not good enough in c++ to do that, so i was just
wondering someone can help me out with it. Thank you.

sandy


Go to www.ioccc.org, they may have something similar. I know they have
stuff that does circles with pi....
Feb 7 '06 #4
hey just a thought you could type cast the int nubers of the charaters
you want to print out. that should be fun :)
Daniel T. wrote:
In article <mD************ ******@newsread 2.news.pas.eart hlink.net>,
"Mike Wahler" <mk******@mkwah ler.net> wrote:

"sandy" <sa************ ***@gmail.com> wrote in message
news:11****** *************** *@o13g2000cwo.g ooglegroups.com ...
Hey guys,

I know this is silly, but I just wanted to take some break from work. I
was just wodering if its possible to write a c++ program that can print
"iloveyou" in shape of 'heart' when executed.


Certainly.

The impotant thing is


Don't say that on Valentine's Day. :-)

that, the program should not show any kind of words related to it, i
mean the program should not be understandable at the very first sight
the user goes through the code. It will be gr8 if something more
creative is achieved out of this idea. Think about it. Let me know if
its possible to make a code that can interact with user and print the
results for just one particular kind of input, and print it in a
beautiful way. I am not good enough in c++ to do that, so i was just
wondering someone can help me out with it. Thank you.


Get some graph paper, and draw the characters (perhaps asterisks) of
the output. After that it should be simple to write some loops to
output various character sequences. If you want to further obfuscate
the source, put random amounts of it in separate functions.

You could also build the "i love you" string from ascii values or
individual chars that are distributed in the code.

Feb 7 '06 #5
Thank you guys, i will check out every advise u guys have me. thank
you,

Sandy

sandy wrote:
Hey guys,

I know this is silly, but I just wanted to take some break from work. I
was just wodering if its possible to write a c++ program that can print
"iloveyou" in shape of 'heart' when executed. The impotant thing is
that, the program should not show any kind of words related to it, i
mean the program should not be understandable at the very first sight
the user goes through the code. It will be gr8 if something more
creative is achieved out of this idea. Think about it. Let me know if
its possible to make a code that can interact with user and print the
results for just one particular kind of input, and print it in a
beautiful way. I am not good enough in c++ to do that, so i was just
wondering someone can help me out with it. Thank you.

sandy


Feb 7 '06 #6
Thank you guys, i will check out every advise u guys have gave me.
thank you,

Sandy

sandy wrote:
Hey guys,

I know this is silly, but I just wanted to take some break from work. I
was just wodering if its possible to write a c++ program that can print
"iloveyou" in shape of 'heart' when executed. The impotant thing is
that, the program should not show any kind of words related to it, i
mean the program should not be understandable at the very first sight
the user goes through the code. It will be gr8 if something more
creative is achieved out of this idea. Think about it. Let me know if
its possible to make a code that can interact with user and print the
results for just one particular kind of input, and print it in a
beautiful way. I am not good enough in c++ to do that, so i was just
wondering someone can help me out with it. Thank you.

sandy


Feb 7 '06 #7
sandy wrote:
Hey guys,

I know this is silly, but I just wanted to take some break from work. I
was just wodering if its possible to write a c++ program that can print
"iloveyou" in shape of 'heart' when executed. The impotant thing is
that, the program should not show any kind of words related to it, i
mean the program should not be understandable at the very first sight
the user goes through the code. It will be gr8 if something more
creative is achieved out of this idea. Think about it. Let me know if
its possible to make a code that can interact with user and print the
results for just one particular kind of input, and print it in a
beautiful way. I am not good enough in c++ to do that, so i was just
wondering someone can help me out with it. Thank you.


One minor point: you've gotten a couple of hints to embed the string as
hex, decimal, etc. numbers in your source code. While this can
obfuscate the source code itself (a little) it has no effect on the
executable -- there the string will stil show up just as if you'd
written it normally.

There are quite a few ways of making it harder to understand. For
example, you could use what is probably the oldest cipher known to man
-- just subtract 3 (or whatever) from each number in the string, and
then add 3 to each character as you print it out.

If you want to make it a bit more complex, you can use a slightly more
complex cipher -- for example, use two strings, and XOR the characters
together as you print them out.

OTOH, instead of obfuscating the string, you could just obfuscate the
code. For example, something like this might be a start in the right
general direction:

#include<iostre am>

char *c[] = { "HILO", "NOTYOU", "TRI", "SHOVE" };
char **cp[] = { c+3, c+2, c+1, c };
char ***cpp = cp;

int main() {
std::cout << **++cpp+2;
std::cout << *--*++cpp+2;
std::cout << *cpp[-2]+3;
std::cout << cpp[-1][-1]+3;
return 0;
}

Obfuscation doesn't require #define's!

--
Later,
Jerry.

Feb 7 '06 #8

sandy wrote:
Hey guys,

I know this is silly, but I just wanted to take some break from work. I
was just wodering if its possible to write a c++ program that can print
"iloveyou" in shape of 'heart' when executed. The impotant thing is
that, the program should not show any kind of words related to it,


Here's a start...
I didn't make much effort in hiding the string though. But otherwise it
should be pretty hard to figure out. Compiles without warning on GCC
3.4.4 with -W -Wall -pedantic.

--- snipp ---
#include <iostream>
#include <string>
int main(){std::str ing g=" I LOVE C++!";
char t[]={0x15,0x0C,0x3 F,0x0F,0xE3,0xF C,0xFF,0xBF,
0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF, 0xFF,0xBF,0xFF, 0xF8,
0xFF,0xFF,0x83, 0xFF,0xF8,0x07, 0xFF,0x00,0x1F, 0xF0,
0x00,0x3E,0x00, 0x00,0x40,0x00} ;char w=t[0],x=w,h=
t[1],y=h,l=g.length ();unsigned i=0;while(y--){x=w;
while(x--){unsigned b=2+i/8,o=7-i%8;std::cout<< (t[
b]&(1<<o)?g[i%l]:' ');i++;}std::co ut<<"\n";}}
--- /snipp ---

Cheers,
Andre

Feb 7 '06 #9
Hi guys,

Very good ideas guys, you helped me get started. Thank you very much.

sandy

sandy wrote:
Hey guys,

I know this is silly, but I just wanted to take some break from work. I
was just wodering if its possible to write a c++ program that can print
"iloveyou" in shape of 'heart' when executed. The impotant thing is
that, the program should not show any kind of words related to it, i
mean the program should not be understandable at the very first sight
the user goes through the code. It will be gr8 if something more
creative is achieved out of this idea. Think about it. Let me know if
its possible to make a code that can interact with user and print the
results for just one particular kind of input, and print it in a
beautiful way. I am not good enough in c++ to do that, so i was just
wondering someone can help me out with it. Thank you.

sandy


Feb 7 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
3613
by: edgrsprj | last post by:
PROPOSED EARTHQUAKE FORECASTING COMPUTER PROGRAM DEVELOPMENT EFFORT Posted July 11, 2005 My main earthquake forecasting Web page is: http://www.freewebz.com/eq-forecasting/Data.html Newsgroup Readers: If you circulate copies of this report to groups of computer programmers at different universities etc. around the world then they might find the subject matter to be interesting.
0
6144
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug file as folows. I need help to resolve them ASAP: cl /c /nologo /MDd /W3 /Od /GR /GM /Zi /GX /D "_DEBUG" /D " WIN32" /D "_W INDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /
11
2615
by: christopher diggins | last post by:
I am wondering if any can point me to any open-source library with program objects for C++ like there is in Java? I would like to be able to write things like MyProgram1 >> MyProgram2 >> Fork(MyProgram3, SomeFile); If not would this be something of interest to others? Thanks in advance,
1
3276
by: Eric Whittaker | last post by:
hi all, im trying to write my first c++ program. a success, but i can't get the window to stay open after user enters input. it just automatically closes. right now the end of my program looks like this: return 0; }
9
4541
by: Hemal | last post by:
Hi All, I need to know the memory required by a c program. Is there any tool/utility which can give me the memory usage in terms of DATA segment, TEXT segment, BSS segment etc. I am working on linux platform and my target is ARM processor. But i guess it should not matter. Actually i need to know both RAM & ROM usage.
7
13271
by: ibtc209 | last post by:
I just started programming in C, and I need some help with this problem. Your program will read the information about one MiniPoker hand, namely the rank and suit of the hand’s first card, and the rank and suit of its second card. Note that the two cards in a hand may be entered in any order; it’s not necessarily the case that the highest card will appear first, for example. Your program will then determine whether the hand is valid, and...
2
19355
Banfa
by: Banfa | last post by:
Posted by Banfa The previous tutorial discussed what programming is, what we are trying to achieve, the answer being a list of instructions constituting a valid program. Now we will discuss how we set about doing that. Every program starts with a specification, this may be a several hundred page document from your latest client or one small paragraph from your professor and pretty much anything in-between. The specification is very...
0
10542
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10309
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10289
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9119
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6840
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3795
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2968
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.