Like Tree4Likes
  • 1 Post By Elysia
  • 3 Post By whiteflags

exercises

This is a discussion on exercises within the C++ Programming forums, part of the General Programming Boards category; Just finished the first chapter of accelerated c++. There is this exercise i'm unable to complete. Here it goes: 'I ...

  1. #1
    Registered User
    Join Date
    Dec 2011
    Location
    Eindhoven, Noord-Brabant, Netherlands
    Posts
    54

    exercises

    Just finished the first chapter of accelerated c++. There is this exercise i'm unable to complete.
    Here it goes: 'I need to write a program that writes: This is (") a double quote. 'I just dunno how to do it.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,598
    Look on the previous page: there is a paragraph on string literals.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    6,253
    The escape sequence to produce a double quote is \". Place that escape sequence in string or character literals, as needed.
    Right 98% of the time, and don't care about the other 3%.

  4. #4
    Registered User
    Join Date
    Dec 2011
    Location
    Eindhoven, Noord-Brabant, Netherlands
    Posts
    54
    Quote Originally Posted by grumpy View Post
    The escape sequence to produce a double quote is \". Place that escape sequence in string or character literals, as needed.
    Thx, but hoe do i That? Can u please gimme an example?

  5. #5
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,538
    std::string Hello = "\"Hello World!\""; // <-- Stores "Hello World!" (with quotes)
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Registered User
    Join Date
    Dec 2011
    Location
    Eindhoven, Noord-Brabant, Netherlands
    Posts
    54
    Quote Originally Posted by Elysia View Post
    std::string Hello = "\"Hello World!\""; // <-- Stores "Hello World!" (with quotes)
    Thz, but it ain't workin. It does work with words, but when i use double quotes, it does'n work.

  7. #7
    Registered User
    Join Date
    Dec 2011
    Location
    Eindhoven, Noord-Brabant, Netherlands
    Posts
    54
    I figured it out, im a genius, hahaahahahah.

  8. #8
    Registered User
    Join Date
    Dec 2011
    Location
    Eindhoven, Noord-Brabant, Netherlands
    Posts
    54
    I would like to take my time to tell u guys this: Look, i am really sick, i always end up at the hospital, most of the times @emergency. I take these medicines against mental illness, and the one i'm currently takin, makes it impossible to learn. SO when i get better, i try to teach myself programming, but it just doesn't work cuz of the damn medicines.
    I give up out of frustration, but then i try to learn again. That's is the reason y i keep comin back and askin the same damn questions over and over again. I jut hope this time I get medicines that actually make me able to learn properly.

  9. #9
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,538
    Next time, if it doesn't work, then show us your code, so we can see exactly why it doesn't work. Compile errors, if you get any, are helpful too.
    stahta01 likes this.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #10
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,660
    Quote Originally Posted by Kuro Tensai View Post
    I would like to take my time to tell u guys this: Look, i am really sick, i always end up at the hospital, most of the times @emergency. I take these medicines against mental illness, and the one i'm currently takin, makes it impossible to learn. SO when i get better, i try to teach myself programming, but it just doesn't work cuz of the damn medicines.
    I give up out of frustration, but then i try to learn again. That's is the reason y i keep comin back and askin the same damn questions over and over again. I jut hope this time I get medicines that actually make me able to learn properly.
    I really don't know what to tell you dude. I'm personally not comfortable with being guilt tripped into teaching someone anything. Even if you can't go outside without exploding I can't take responsibility for how well you learn things.

    How to Properly Research Online (and Not Embarrass Yourself with the Results)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ Exercises
    By GReaper in forum C++ Programming
    Replies: 11
    Last Post: 07-17-2010, 01:22 PM
  2. exercises in c++
    By BEN10 in forum C++ Programming
    Replies: 2
    Last Post: 07-26-2008, 04:07 AM
  3. C# Exercises
    By Rainbowinblack in forum C# Programming
    Replies: 0
    Last Post: 01-17-2008, 12:47 PM
  4. C++ Exercises
    By lasher in forum C++ Programming
    Replies: 6
    Last Post: 12-06-2006, 08:48 PM
  5. Exercises
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 10-14-2001, 11:29 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21