1. This forum is in read-only mode.

While loop error/national debt to gdp percentage calculator

Discussion in 'Computers & Modding' started by vivo, Oct 28, 2011.

  1. vivo

    vivo Well-Known Member

    Code:
     char GDP1[30];
      int GDP;
      char natdebt1[30];
      int natdebt;
      float dpg; /* debt percentage of gdp */
      float counter;
      printf("Please enter the GDP of the country this company is located in.\n");
      gets(GDP1);
      GDP=atoi (GDP1);
      printf("Please enter the National Debt for the country this company is located in.      (Please include unfunded liabilities in addition to the budget deficit) \n");
      gets(natdebt1);
      natdebt=atoi(natdebt1);
      counter=0.01;
      while(dpg=GDP*0.01; dpg<natdebt; dpg++)
      {
        counter=counter++;
      };
      printf("Debt to GDP is %f percent. \n",counter);
    
    I have been trying to find a way to have a decimal percentage of the national debt (of any country, but I am using the US debt to) and start at one percent of GDP and work up to the national debt (Including unfunded liabilities). But I ran across this
    C:\QPCCaluclator\original2.c|80|error: expected ')' before ';' token| . I have tried everything, but it won't work. Thanks,
    vivo.
     
  2. Jonez001

    Jonez001 Well-Known Member

    Wow, this isn't Java isn't it?
     
  3. vivo

    vivo Well-Known Member

    haha, not
     
  4. Jonez001

    Jonez001 Well-Known Member

    Damn, I wish it was! Then i could help you
     
  5. vivo

    vivo Well-Known Member

    Well, code you type anything in pseudo-code maybe?
     
  6. Jonez001

    Jonez001 Well-Known Member

    I don't have the time atm...
     
  7. Loonylion

    Loonylion Administrator Staff Member

    at a guess, its your second printf line. those inner brackets probably need escaping.
     
  8. vivo

    vivo Well-Known Member

    I found what was wrong. I was using the syntax of FOR in s WHILE statemtent. LOL sorry. Thanks for the help.