Click here to Skip to main content
15,920,828 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questioni want to learn visual C++ 6 Pin
knowledgelover22-Oct-05 20:03
knowledgelover22-Oct-05 20:03 
AnswerRe: i want to learn visual C++ 6 Pin
Anonymous23-Oct-05 17:19
Anonymous23-Oct-05 17:19 
Questionrookie question Pin
Binary011022-Oct-05 17:43
Binary011022-Oct-05 17:43 
AnswerRe: rookie question Pin
Anonymous22-Oct-05 18:55
Anonymous22-Oct-05 18:55 
AnswerRe: rookie question Pin
Anonymous22-Oct-05 19:14
Anonymous22-Oct-05 19:14 
GeneralRe: rookie question Pin
Binary011022-Oct-05 20:22
Binary011022-Oct-05 20:22 
GeneralRe: rookie question Pin
PJ Arends22-Oct-05 20:31
professionalPJ Arends22-Oct-05 20:31 
GeneralRe: rookie question Pin
Anonymous23-Oct-05 3:25
Anonymous23-Oct-05 3:25 
Couple more things:

- your minutes_per_hour constant should 60, not 59.

- your hours calculation, even though it is commented out, is not correct.

- after incrementing minutes, you should probably adjust its value using the mod function (% function).

Below is example code also using PJ's setw(2) change:

// Program constants
const int minutes_per_hour = 60;

// Computations
minutes = minutes + 1;

hours = hours + (minutes / minutes_per_hour);   // Line 1
minutes = minutes % minutes_per_hour;           // Line 2

// Output
cout << " The time is: " << hours << ":"<< setfill('0') << setw(2) << minutes << endl;
In Line 1, the expression "x / y" returns the integral portion of x divided by y. When x is 60 and y is 60, this expression yields 1, which will increment the hours by 1. When x is less than y, this expression yields 0, and the hours value is unchanged.

In Line 2, the expression "x % y" returns the remainder value that you get when you divide x by y. If x is less than y, it returns just the value x. If x is 60 and y is 60, the remainder is 0, which handles the case when the minutes goes past 59 (you want it to display 00).
GeneralRe: rookie question Pin
Binary011023-Oct-05 7:42
Binary011023-Oct-05 7:42 
QuestionCObList, MoveTo(), LineTo(), and more Pin
Anonymous22-Oct-05 17:09
Anonymous22-Oct-05 17:09 
AnswerRe: CObList, MoveTo(), LineTo(), and more Pin
Ravi Bhavnani22-Oct-05 20:31
professionalRavi Bhavnani22-Oct-05 20:31 
AnswerRe: CObList, MoveTo(), LineTo(), and more Pin
PJ Arends22-Oct-05 20:40
professionalPJ Arends22-Oct-05 20:40 
GeneralRe: CObList, MoveTo(), LineTo(), and more Pin
Anonymous23-Oct-05 5:34
Anonymous23-Oct-05 5:34 
AnswerRe: CObList, MoveTo(), LineTo(), and more Pin
Gary R. Wheeler23-Oct-05 1:30
Gary R. Wheeler23-Oct-05 1:30 
Questionabout the array Pin
hhgg22-Oct-05 14:40
hhgg22-Oct-05 14:40 
AnswerRe: about the array Pin
PJ Arends22-Oct-05 16:05
professionalPJ Arends22-Oct-05 16:05 
GeneralRe: about the array Pin
Gary R. Wheeler23-Oct-05 1:36
Gary R. Wheeler23-Oct-05 1:36 
GeneralRe: about the array Pin
hhgg25-Oct-05 7:52
hhgg25-Oct-05 7:52 
Questionwhat is the best way to get html code? Pin
hamavreg22-Oct-05 14:01
hamavreg22-Oct-05 14:01 
Questioncopy folder Pin
stef880322-Oct-05 7:52
stef880322-Oct-05 7:52 
AnswerRe: copy folder Pin
Ravi Bhavnani22-Oct-05 8:12
professionalRavi Bhavnani22-Oct-05 8:12 
GeneralRe: copy folder Pin
stef880322-Oct-05 8:17
stef880322-Oct-05 8:17 
GeneralRe: copy folder Pin
Ravi Bhavnani22-Oct-05 8:24
professionalRavi Bhavnani22-Oct-05 8:24 
GeneralRe: copy folder Pin
stef880322-Oct-05 8:31
stef880322-Oct-05 8:31 
GeneralRe: copy folder Pin
Ravi Bhavnani22-Oct-05 8:42
professionalRavi Bhavnani22-Oct-05 8:42 

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.