Thread: 2 simple C++ probs

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    2

    2 simple C++ probs

    2 simple C++ probs

    I everyone, im trying to solve these 2 questions. n have a look if I got the right answer for u guys.
    this has been the 1st time I learn C++ and a lot of stuff I dont understand. cheers.
    A

    ---------------

    question1 :

    Write a C++ program that inputs date, month from user in the format DD/MM and outputs in format DDth/DDrd/DDst/DDnd of <MONTH NAME> for year 2009 only.

    Sample outputs:

    Run 1:

    Enter date (DD/MM): 14/07
    14th of July

    Run 2:

    Enter date (DD/MM): 3/12
    3rd of December

    --------------------------

    question 2:

    Write a C++ program that inputs user’s name (first and last), gender and marital status and greets him/her accordingly as (Mr./Ms./Mrs.) followed by family name (You can assumed that gender is entered as ‘m’ or ‘f’ and marital status as ‘y’ or ‘n’).

    Sample outputs:

    Run 1:

    Name: Julia Styles
    Gender: f
    Married: n
    Hello Ms. Styles

    Run 2:

    Name: Mary Jacobi
    Gender: f
    Married: y
    Hello Mrs. Jacobi
    --------------------------

    my answer to question 1( : S )



    thanks guys.

    A

  2. #2
    Registered User
    Join Date
    Mar 2009
    Posts
    2
    i dont know how to post my answer, it says code tag or somethin.

    can anyone gimme a right solution to these 2,
    many thanks

    A

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by alikoolg
    i dont know how to post my answer, it says code tag or somethin.
    That is, post your code in [code][/code] bbcode tags, e.g.,
    Code:
    [code]#include <iostream>
    
    int main()
    {
        std::cout << "Hello world!" << std::endl;
    }[/code]
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by alikoolg View Post
    can anyone gimme a right solution to these 2,
    It's right here.

  5. #5
    Or working on it anyways mramazing's Avatar
    Join Date
    Dec 2005
    Location
    Lehi, UT
    Posts
    121
    Have you tried to solve them? You should give them a shot. You might be able to do more than you think.
    -- Will you show me how to c++?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. creating very simple text editor using c
    By if13121 in forum C Programming
    Replies: 9
    Last Post: 10-19-2010, 05:26 PM
  2. Simple message encryption
    By Vicious in forum C++ Programming
    Replies: 10
    Last Post: 11-07-2004, 11:48 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Simple simple program
    By Ryback in forum C++ Programming
    Replies: 10
    Last Post: 09-09-2004, 05:48 AM
  5. Need help with simple DAQ program
    By canada-paul in forum C++ Programming
    Replies: 12
    Last Post: 03-15-2002, 08:52 AM