It's supposed to output a big "Yang" that looks kinda on fire, but after being compiled and when I run it, it's really messed up. Is it because of my compiler?
I'm using GNU GCC compiler btw.
Sponsor Sponsor
Tony
Posted: Sat Mar 16, 2013 7:42 pm Post subject: RE:The output of my program isn\'t what I want it to
The problem with your code is that the strings contain the escape character ("\"). I won't explain what it does, but to use it in a string you must type in two of them ("\\") and thus your output will only display as one.
Cancer Sol
Posted: Sat Mar 16, 2013 7:58 pm Post subject: Re: The output of my program isn't what I want it to
TZak @ 3/16/2013, 7:56 pm wrote:
I've never coded in c++ and even I know this. Here take a look at this:
The problem with your code is that the strings contain the escape character ("\"). I won't explain what it does, but to use it in a string you must type in two of them ("\\") and thus your output will only display as one.
Oh crap... I feel so newbie :3 I am a noob anyways though xD
Thanks a lot!
@Tony Well idk why, but it worked for me though :/
Goddamnit... it makes the code look so messyy now, and on the console, it looks bad
Time to change how it looks
Tony
Posted: Sat Mar 16, 2013 8:09 pm Post subject: Re: The output of my program isn't what I want it to
the escape character exists so that one can describe special characters
\n -- new line
\t -- tab
etc.
Of course that leaves us with a single problem -- how to describe a sequence of characters "\n" as backslash.n instead of newline? Well, you escape the escape character! \\n
Cancer Sol @ Sat Mar 16, 2013 7:58 pm wrote:
@Tony Well idk why, but it worked for me though :/
Posted: Sun Mar 17, 2013 8:14 pm Post subject: Re: The output of my program isn't what I want it to
Tony @ 3/16/2013, 8:09 pm wrote:
the escape character exists so that one can describe special characters
\n -- new line
\t -- tab
etc.
Of course that leaves us with a single problem -- how to describe a sequence of characters "\n" as backslash.n instead of newline? Well, you escape the escape character! \\n
Cancer Sol @ Sat Mar 16, 2013 7:58 pm wrote:
@Tony Well idk why, but it worked for me though :/
Show that
I don't like using \n, it makes my code look kinda confusing to me :/
I always thought \t was useless because I could just press tab myself, but I just remembered, pressing tab doesn't do anything to the output xD
Posted: Sun Mar 17, 2013 8:35 pm Post subject: Re: The output of my program isn't what I want it to
Was I only able to compile it because my compiler discarded them?
Just wondering though, did you compile it with GNU GCC compiler or was it a different one?
Sponsor Sponsor
wtd
Posted: Sun Mar 17, 2013 8:53 pm Post subject: RE:The output of my program isn\'t what I want it to
It compiled because it's a valid program; just not the one you meant to write. The issue is compiler-independent.
Tony
Posted: Sun Mar 17, 2013 8:53 pm Post subject: RE:The output of my program isn\'t what I want it to
Posted: Mon Mar 18, 2013 12:07 pm Post subject: Re: The output of my program isn't what I want it to
No wonder, I thought I might've posted the wrong code actually before I tested the program again
Does it differ if I'm using Windows or an ios based operating system?
and I've always wondered this, what's a linux? I've never really seen it before :/
DemonWasp
Posted: Mon Mar 18, 2013 12:37 pm Post subject: RE:The output of my program isn\'t what I want it to
Compiler specifics vary wildly between the various platforms (operating system and CPU-type combinations, such as Windows on x86, Windows on x64, Linux x86, Linux ARM, Linux Sparc, Linux PowerPC, Linux x64, Linux Itanium, ...).
Linux is an operating system kernel. It's bundled with a lot of utilities made by the GNU group, so properly the base operating system is called GNU/Linux, though most people just call it Linux. There are hundreds or thousands of "distributions" of Linux, each of which gives you a slightly different user interface and set of programs.
So, when people say "linux", they usually mean "a distribution of the GNU/Linux base system, with a bunch of other stuff on top".
Nearly all distributions are free and open-source. Support is generally not free, but there are communities that offer support for each distribution. You can install most distributions by downloading a CD or DVD image, burning it to disk, putting that disk in the drive and rebooting (subject to BIOS boot order and a lot of complexity I won't get into here).
There are a few much-more-popular desktop distributions, including Ubuntu, Mint, and Debian (all in the same "family", with Debian being the "father"). Android is based on Linux. With Ubuntu and Mint, you can download a "LiveCD", which is just a disk that you can start the operating system from, without needing to permanently change anything about your existing computer setup.
wtd
Posted: Mon Mar 18, 2013 9:48 pm Post subject: Re: RE:The output of my program isn\'t what I want it to
DemonWasp @ Tue Mar 19, 2013 1:37 am wrote:
Compiler specifics vary wildly between the various platforms (operating system and CPU-type combinations, such as Windows on x86, Windows on x64, Linux x86, Linux ARM, Linux Sparc, Linux PowerPC, Linux x64, Linux Itanium, ...).
Technically correct, but irrelevant when used to compile basic programs.
Cancer Sol
Posted: Wed Mar 20, 2013 6:48 pm Post subject: Re: RE:The output of my program isn\'t what I want it to
DemonWasp @ 3/18/2013, 12:37 pm wrote:
Compiler specifics vary wildly between the various platforms (operating system and CPU-type combinations, such as Windows on x86, Windows on x64, Linux x86, Linux ARM, Linux Sparc, Linux PowerPC, Linux x64, Linux Itanium, ...).
Linux is an operating system kernel. It's bundled with a lot of utilities made by the GNU group, so properly the base operating system is called GNU/Linux, though most people just call it Linux. There are hundreds or thousands of "distributions" of Linux, each of which gives you a slightly different user interface and set of programs.
So, when people say "linux", they usually mean "a distribution of the GNU/Linux base system, with a bunch of other stuff on top".
Nearly all distributions are free and open-source. Support is generally not free, but there are communities that offer support for each distribution. You can install most distributions by downloading a CD or DVD image, burning it to disk, putting that disk in the drive and rebooting (subject to BIOS boot order and a lot of complexity I won't get into here).
There are a few much-more-popular desktop distributions, including Ubuntu, Mint, and Debian (all in the same "family", with Debian being the "father"). Android is based on Linux. With Ubuntu and Mint, you can download a "LiveCD", which is just a disk that you can start the operating system from, without needing to permanently change anything about your existing computer setup.
You can use Linux on a windows computer then?
Insectoid
Posted: Wed Mar 20, 2013 6:54 pm Post subject: RE:The output of my program isn\'t what I want it to
You can replace Windows with Linux on a computer. Or you can give your computer the option to use either Windows or Linux if you want to.