Click here to Skip to main content
15,902,635 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: problem with adding About Diaglog Pin
tataxin29-May-08 14:45
tataxin29-May-08 14:45 
QuestionRe: problem with adding About Diaglog Pin
David Crow30-May-08 3:12
David Crow30-May-08 3:12 
NewsRe: problem with adding About Diaglog [modified] Pin
tataxin1-Jun-08 15:53
tataxin1-Jun-08 15:53 
QuestionDetecting available MIDI devices Pin
rp_suman28-May-08 22:00
rp_suman28-May-08 22:00 
AnswerRe: Detecting available MIDI devices Pin
SandipG 28-May-08 22:35
SandipG 28-May-08 22:35 
GeneralRe: Detecting available MIDI devices Pin
rp_suman29-May-08 15:08
rp_suman29-May-08 15:08 
QuestionRegLoadKey Pin
Ajay L D28-May-08 21:22
Ajay L D28-May-08 21:22 
AnswerRe: RegLoadKey Pin
Hamid_RT30-May-08 2:17
Hamid_RT30-May-08 2:17 
QuestionHow can i shorten my array using enum? Pin
monsieur_jj28-May-08 20:47
monsieur_jj28-May-08 20:47 
QuestionRe: How can i shorten my array using enum? Pin
SandipG 28-May-08 21:13
SandipG 28-May-08 21:13 
AnswerRe: How can i shorten my array using enum? Pin
monsieur_jj28-May-08 21:18
monsieur_jj28-May-08 21:18 
GeneralRe: How can i shorten my array using enum? Pin
SandipG 28-May-08 21:19
SandipG 28-May-08 21:19 
GeneralRe: How can i shorten my array using enum? Pin
monsieur_jj28-May-08 21:25
monsieur_jj28-May-08 21:25 
GeneralRe: How can i shorten my array using enum? Pin
Arman S.28-May-08 21:28
Arman S.28-May-08 21:28 
GeneralRe: How can i shorten my array using enum? Pin
SandipG 28-May-08 21:30
SandipG 28-May-08 21:30 
GeneralRe: How can i shorten my array using enum? Pin
monsieur_jj28-May-08 21:36
monsieur_jj28-May-08 21:36 
GeneralRe: How can i shorten my array using enum? Pin
SandipG 28-May-08 21:46
SandipG 28-May-08 21:46 
AnswerRe: How can i shorten my array using enum? Pin
_AnsHUMAN_ 28-May-08 21:29
_AnsHUMAN_ 28-May-08 21:29 
AnswerRe: How can i shorten my array using enum? Pin
Rajesh R Subramanian28-May-08 22:03
professionalRajesh R Subramanian28-May-08 22:03 
AnswerRe: How can i shorten my array using enum? Pin
Nibu babu thomas28-May-08 22:29
Nibu babu thomas28-May-08 22:29 
GeneralRe: How can i shorten my array using enum? [modified] Pin
Rajesh R Subramanian28-May-08 22:49
professionalRajesh R Subramanian28-May-08 22:49 
AnswerRe: How can i shorten my array using enum? Pin
David Crow29-May-08 4:04
David Crow29-May-08 4:04 
monsieur_jj wrote:
SchedTime[0] = "12:00 AM"; SchedTime[1] = "1:00 AM"; SchedTime[2] = "2:00 AM"; SchedTime[3] = "3:00 AM"; SchedTime[4] = "4:00 AM"; SchedTime[5] = "5:00 AM"; SchedTime[6] = "6:00 AM"; SchedTime[7] = "7:00 AM"; SchedTime[8] = "8:00 AM"; SchedTime[9] = "9:00 AM"; SchedTime[10] = "10:00 AM"; SchedTime[11] = "11:00 AM"; SchedTime[12] = "12:00 PM"; SchedTime[13] = "1:00 PM"; SchedTime[14] = "2:00 PM"; SchedTime[15] = "3:00 PM"; SchedTime[16] = "4:00 PM"; SchedTime[17] = "5:00 PM"; SchedTime[18] = "6:00 PM"; SchedTime[19] = "7:00 PM"; SchedTime[20] = "8:00 PM"; SchedTime[21] = "9:00 PM"; SchedTime[22] = "10:00 PM"; SchedTime[23] = "11:00 PM"; for(timecount = 0; timecount<24; timecount++) { c_cbCombo2.InsertString(timecount, _T(SchedTime[timecount].c_str())); }


You could shorten this a bit by trying something like:

for (timecount = 0; timecount<24; timecount++)
{
    CString str;
    int nHour = timecount % 12;
    if (0 == nHour) nHour = 12;
    str.Format(_T("%d:00 %s"), nHour, (nHour >= 12 && nHour <= 23) ? _T("PM") : _T("AM"));
    c_cbCombo2.InsertString(timecount, str);
}


"Love people and use things, not love things and use people." - Unknown

"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne


GeneralRe: How can i shorten my array using enum? Pin
Rajkumar R29-May-08 19:50
Rajkumar R29-May-08 19:50 
GeneralRe: How can i shorten my array using enum? Pin
David Crow30-May-08 4:10
David Crow30-May-08 4:10 
QuestionHow to know whether our application is focused or not? Pin
Super Hornet28-May-08 20:43
Super Hornet28-May-08 20:43 

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.