Click here to Skip to main content
15,892,809 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Change Item Text Color - CListCtrl Pin
David Crow29-May-12 3:34
David Crow29-May-12 3:34 
Questionproblem with tamplate deque Pin
a1_shay27-May-12 20:07
a1_shay27-May-12 20:07 
AnswerRe: problem with tamplate deque Pin
«_Superman_»27-May-12 21:33
professional«_Superman_»27-May-12 21:33 
GeneralRe: problem with tamplate deque Pin
CPallini27-May-12 21:39
mveCPallini27-May-12 21:39 
GeneralRe: problem with tamplate deque Pin
a1_shay27-May-12 23:36
a1_shay27-May-12 23:36 
GeneralRe: problem with tamplate deque Pin
CPallini27-May-12 23:51
mveCPallini27-May-12 23:51 
AnswerRe: problem with tamplate deque Pin
CPallini27-May-12 21:38
mveCPallini27-May-12 21:38 
AnswerRe: problem with tamplate deque Pin
Aescleal28-May-12 5:22
Aescleal28-May-12 5:22 
Woa there Tex! Three are the things that jump out at me reading your code:

- switch statement from hell. At least call a function per case statement rather than piling all your code in one place

- mixing cstdio with iostream. Don't do it unless you're an expert. If you are an expert think twice about why you need to mix them.

- don't bother using exit(n); in main. return n; has the same effect.

The error you're getting is going to be something like "initialization of variable is skipped by switch statment." What that means is if someone enters 'f', 'g', 'h' the constructor for a won't be called. The flow of control goes galloping past, jumping over the initialisation of a. In your case this isn't a problem as a isn't used elsewhere. To get around this either stick everything that's currently in a case statement in a function OR use an additional level of scope around your case statement. I'd go for functions personally as scoped cases can get a bit ugly:
C++
case 'e':
{
    int numbers;
    cout<<"how many number you want in queue:";
    cin >> numbers;
    j a(numbers,0);
    printf("\n");    // Ugh, spit, gag, splutter, remove me!!
    flushall();
    break;
}
break;


Anyway, hope that helps. If not shout and we'll see what we can do to improve our answers.

Edit: Realised that I'd said the wrong set of case statements avoided calling the constructor. Hopefully corrected that now!

modified 29-May-12 6:37am.

GeneralRe: problem with tamplate deque Pin
a1_shay28-May-12 18:32
a1_shay28-May-12 18:32 
QuestionRe: problem with tamplate deque Pin
David Crow28-May-12 16:58
David Crow28-May-12 16:58 
QuestionHow to integrate cxxTest with Visual Studio IDE Pin
rajKR1227-May-12 19:14
rajKR1227-May-12 19:14 
AnswerRe: How to integrate cxxTest with Visual Studio IDE Pin
Aescleal28-May-12 5:25
Aescleal28-May-12 5:25 
GeneralRe: How to integrate cxxTest with Visual Studio IDE Pin
rajKR125-Jun-12 19:03
rajKR125-Jun-12 19:03 
QuestionCross Platform Development Pin
AmbiguousName27-May-12 0:49
AmbiguousName27-May-12 0:49 
AnswerRe: Cross Platform Development Pin
enhzflep27-May-12 6:16
enhzflep27-May-12 6:16 
AnswerRe: Cross Platform Development Pin
Aescleal28-May-12 5:06
Aescleal28-May-12 5:06 
QuestionApplication Watchdog Pin
Richard Andrew x6426-May-12 16:43
professionalRichard Andrew x6426-May-12 16:43 
AnswerRe: Application Watchdog Pin
«_Superman_»26-May-12 17:30
professional«_Superman_»26-May-12 17:30 
GeneralRe: Application Watchdog Pin
Richard Andrew x6426-May-12 17:42
professionalRichard Andrew x6426-May-12 17:42 
AnswerRe: Application Watchdog Pin
Ashish Tyagi 4029-May-12 19:41
Ashish Tyagi 4029-May-12 19:41 
QuestionTask Manager Pin
Bram van Kampen26-May-12 12:46
Bram van Kampen26-May-12 12:46 
AnswerRe: Task Manager Pin
Randor 26-May-12 13:07
professional Randor 26-May-12 13:07 
AnswerRe: Task Manager Pin
«_Superman_»26-May-12 17:23
professional«_Superman_»26-May-12 17:23 
GeneralRe: Task Manager Pin
Bram van Kampen27-May-12 4:44
Bram van Kampen27-May-12 4:44 
QuestionUsing namespace in VC6.0 ? Pin
Vaclav_26-May-12 6:53
Vaclav_26-May-12 6:53 

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.