Click here to Skip to main content
15,905,566 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Registry Pin
Rajkumar R17-Feb-08 3:52
Rajkumar R17-Feb-08 3:52 
GeneralRe: Registry Pin
Bram van Kampen17-Feb-08 6:19
Bram van Kampen17-Feb-08 6:19 
AnswerRe: Registry Pin
Rajkumar R17-Feb-08 17:14
Rajkumar R17-Feb-08 17:14 
GeneralRe: Registry Pin
Hamid_RT18-Feb-08 7:18
Hamid_RT18-Feb-08 7:18 
QuestionCapture the ID Button clicked by mouse in a game Pin
Rafael Pacheco16-Feb-08 13:37
Rafael Pacheco16-Feb-08 13:37 
QuestionRe: Capture the ID Button clicked by mouse in a game Pin
Rajkumar R17-Feb-08 2:26
Rajkumar R17-Feb-08 2:26 
Questionnoob needs some help with C++ programming class Pin
boomer7916-Feb-08 13:09
boomer7916-Feb-08 13:09 
GeneralNevermind, figured it out... Pin
boomer7916-Feb-08 14:16
boomer7916-Feb-08 14:16 
But I do need some advice on what to do to give the user an option to continue using the program or to exit. My completed code is below. Thanks.


// **************************************************************************
//
// Astrology.cpp
//
// Prompts for the user's birthday and returns the user's
// astrological sign.
// **************************************************************************
#include <iostream>

int getMonth();
// Precondition: User will enter birth month
// Postcondition: Returns 1 <= birth month <= 12

int getDay();
// Precondition: User will enter birth day
// Postcondition: Returns 1 <= birth day <= 31

int getSign(int month, int day);
// Precondition: 1 <= month <= 12, 1 <= day <= 31
// Postcondition: Returns integer corresponding to astrological sign for
// given month and day starting with Capricorn = 1.

int main()
{
using namespace std;
int month;
int day;

//
// Get birth month and day.
//

month = getMonth();
day = getDay();

//
// Determine and print the user's sign
//

cout << "Your sign is ";


// --------------------------------
// ----- ENTER YOUR CODE HERE -----
// --------------------------------
switch (month)
{
case 1:
if (day <= 19)
cout << "Capricorn.";
else
cout <<"Aquarius.";
break;
case 2:
if (day <= 18)
cout << "Aquarius.";
else
cout <<"Pisces.";
break;
case 3:
if (day <= 20)
cout << "Pisces.";
else
cout <<"Aries.";
break;
case 4:
if (day <= 19)
cout << "Pisces.";
else
cout <<"Taurus.";
break;
case 5:
if (day <= 20)
cout << "Taurus.";
else
cout <<"Gemini.";
break;
case 6:
if (day <= 20)
cout << "Gemini.";
else
cout <<"Cancer.";
break;
case 7:
if (day <= 22)
cout << "Cancer.";
else
cout <<"Leo.";
break;
case 8:
if (day <= 22)
cout << "Leo.";
else
cout <<"Virgo.";
break;
case 9:
if (day <= 22)
cout << "Virgo.";
else
cout <<"Libra.";
break;
case 10:
if (day <= 22)
cout << "Libra.";
else
cout <<"Scorpio.";
break;
case 11:
if (day <= 21)
cout << "Scorpio.";
else
cout <<"Sagittarius.";
break;
case 12:
if (day <= 21)
cout << "Sagittarius.";
else
cout <<"Capricorn.";
break;
}
// --------------------------------
// --------- END USER CODE --------
// --------------------------------


cout << endl;

}


int getMonth()
{
using namespace std;

int month;
cout << "Enter the month of your birthday (1-12): ";
cin >> month;
while ((month < 1) || (month > 12))
{
cout << "Month must be between 1 and 12; please re-enter: ";
cin >> month;
}
return month;
}


int getDay()
{
using namespace std;

int day;
cout << "Enter the day of your birthday (1-31): ";
cin >> day;
while ((day < 0) || (day > 31))
{
cout << "Day must be between 1 and 31; please re-enter: ";
cin >> day;
}
return day;
}
GeneralRe: Nevermind, figured it out... Pin
Bram van Kampen17-Feb-08 4:52
Bram van Kampen17-Feb-08 4:52 
GeneralRe: noob needs some help with C++ programming class Pin
Hamid_RT18-Feb-08 7:32
Hamid_RT18-Feb-08 7:32 
GeneralMFC - ADO - Windows Vista Pin
Demian Panello16-Feb-08 10:09
Demian Panello16-Feb-08 10:09 
QuestionNeed some solutions! Pin
Johan1316-Feb-08 8:04
Johan1316-Feb-08 8:04 
GeneralRe: Need some solutions! Pin
Hamid_RT18-Feb-08 7:33
Hamid_RT18-Feb-08 7:33 
QuestionReading a file into an array Pin
jonsey2984716-Feb-08 4:51
jonsey2984716-Feb-08 4:51 
GeneralRe: Reading a file into an array Pin
CPallini16-Feb-08 6:54
mveCPallini16-Feb-08 6:54 
GeneralRe: Reading a file into an array Pin
jonsey2984716-Feb-08 8:24
jonsey2984716-Feb-08 8:24 
GeneralRe: Reading a file into an array Pin
CPallini16-Feb-08 10:01
mveCPallini16-Feb-08 10:01 
GeneralRe: Reading a file into an array Pin
jonsey2984716-Feb-08 15:25
jonsey2984716-Feb-08 15:25 
GeneralRe: Reading a file into an array Pin
CPallini16-Feb-08 22:35
mveCPallini16-Feb-08 22:35 
GeneralRe: Reading a file into an array Pin
jonsey2984717-Feb-08 10:18
jonsey2984717-Feb-08 10:18 
GeneralRe: Reading a file into an array Pin
CPallini17-Feb-08 21:53
mveCPallini17-Feb-08 21:53 
GeneralRe: Reading a file into an array Pin
Rajkumar R16-Feb-08 23:47
Rajkumar R16-Feb-08 23:47 
GeneralRe: Reading a file into an array Pin
jonsey2984717-Feb-08 10:31
jonsey2984717-Feb-08 10:31 
GeneralRe: Reading a file into an array Pin
Rajkumar R17-Feb-08 18:22
Rajkumar R17-Feb-08 18:22 
GeneralRe: Reading a file into an array Pin
jonsey2984718-Feb-08 11:34
jonsey2984718-Feb-08 11:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.