Click here to Skip to main content
14,635,061 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Real time drawing using multithreading Pin
FrankStar8914-Sep-15 21:50
MemberFrankStar8914-Sep-15 21:50 
QuestionNeed help with this little C program Pin
Member 1197963712-Sep-15 12:44
MemberMember 1197963712-Sep-15 12:44 
SuggestionRe: Need help with this little C program Pin
Richard MacCutchan12-Sep-15 21:00
mveRichard MacCutchan12-Sep-15 21:00 
AnswerRe: Need help with this little C program Pin
CPallini13-Sep-15 6:52
mveCPallini13-Sep-15 6:52 
GeneralRe: Need help with this little C program Pin
Member 1197963713-Sep-15 8:05
MemberMember 1197963713-Sep-15 8:05 
GeneralRe: Need help with this little C program Pin
CPallini13-Sep-15 10:23
mveCPallini13-Sep-15 10:23 
QuestionRe: Need help with this little C program Pin
Member 1197963713-Sep-15 12:24
MemberMember 1197963713-Sep-15 12:24 
AnswerRe: Need help with this little C program Pin
CPallini13-Sep-15 21:13
mveCPallini13-Sep-15 21:13 
You don't use correctly scanf. Try
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(int argc, char *argv[])
{
  int a, b, c, x, y, z; /* x=numbers of a y= numbers of b z= numbers of c*/

  int done = 0;

  while ( done == 0)
  {
    printf("please enter the price of a:\n");
    if ( scanf("%d", &a) != 1) continue;
    printf("please enter the price of b:\n");
    if ( scanf("%d", &b) != 1) continue;
    printf("please enter the price of c:\n");
    if ( scanf("%d", &c) != 1) continue;
    done = 1;
  }

  for(x = 0; x <= 100; x++)
  {
      for(y = 0; y <= (100 - x); ++y)
      {
                z = 100 - x - y;
                if(x*a + y*b + z*c == 10000)
                {
                  printf("%d a, %d b, %d c\n",x ,y ,z);
                }
      }
  }

return 0;
}



QuestionRe: Need help with this little C program Pin
Member 1197963714-Sep-15 2:42
MemberMember 1197963714-Sep-15 2:42 
AnswerRe: Need help with this little C program Pin
Member 1197963714-Sep-15 2:55
MemberMember 1197963714-Sep-15 2:55 
GeneralRe: Need help with this little C program Pin
CPallini14-Sep-15 3:40
mveCPallini14-Sep-15 3:40 
SuggestionRe: Need help with this little C program Pin
David Crow14-Sep-15 4:40
MemberDavid Crow14-Sep-15 4:40 
GeneralRe: Need help with this little C program Pin
Member 1197963714-Sep-15 6:10
MemberMember 1197963714-Sep-15 6:10 
QuestionC++ lambda callbacks, how to initialize with NULL pointer ? Pin
Member 853403512-Sep-15 0:45
MemberMember 853403512-Sep-15 0:45 
AnswerRe: C++ lambda callbacks, how to initialize with NULL pointer ? Pin
Richard Andrew x6414-Sep-15 11:36
professionalRichard Andrew x6414-Sep-15 11:36 
GeneralRe: C++ lambda callbacks, how to initialize with NULL pointer ? Pin
Member 853403514-Sep-15 21:42
MemberMember 853403514-Sep-15 21:42 
Questiondata structure and algoritm Pin
Member 1197512010-Sep-15 10:26
MemberMember 1197512010-Sep-15 10:26 
AnswerRe: data structure and algoritm Pin
Afzaal Ahmad Zeeshan10-Sep-15 10:41
mvaAfzaal Ahmad Zeeshan10-Sep-15 10:41 
GeneralRe: data structure and algoritm Pin
Member 1197512010-Sep-15 10:55
MemberMember 1197512010-Sep-15 10:55 
QuestionRe: data structure and algoritm Pin
CPallini10-Sep-15 21:19
mveCPallini10-Sep-15 21:19 
AnswerRe: data structure and algoritm Pin
David Crow11-Sep-15 2:11
MemberDavid Crow11-Sep-15 2:11 
QuestionRe: data structure and algoritm Pin
CPallini11-Sep-15 2:35
mveCPallini11-Sep-15 2:35 
AnswerRe: data structure and algoritm Pin
jschell11-Sep-15 11:08
Memberjschell11-Sep-15 11:08 
AnswerRe: data structure and algoritm Pin
David Crow11-Sep-15 2:10
MemberDavid Crow11-Sep-15 2:10 
AnswerRe: data structure and algoritm Pin
jschell11-Sep-15 11:12
Memberjschell11-Sep-15 11:12 

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.