nickichl Posted January 22, 2009 Share Posted January 22, 2009 Hi i'm new to C programming, and i have this homework which i need to do on compounding interest, i would like to know whats wrong. it says, "Run-Time Check Failure #3 - The variable 'HoursWorked' is being used without being initialized." same with other variables. below is my code. Please help me! Help appreciated :D oh, and im using microsoft visual studio 2005, school default, cant upgrade. settings used its general settings. #include <stdio.h>#include <math.h> #define FALSE 0 #define TRUE 1 void main (void) { int HoursWorked,Hours,Hour,userc,Y,Years,menu,million,done,millionare,settings_complete; float MoneySpent,MoneyMade,MoneyLeftOver,MoneyLeft,MoneySpentI,PricePerHour,startbalance,Total,WeekMoneyMade,CI; while(done = true) //While Loops { printf("This program calculates the compounded interest in each year.\n"); printf("\n Menu \n"); printf("1 - Settings\n"); printf("2 - Account Summary\n"); printf("3 - Quit\n"); printf("******************\n"); printf("Enter Your Choice:"); scanf("%d",&menu); switch(menu) { case 1: printf("\t Menu - Settings\n"); printf("1 - Edit - Money Per Hour\n"); printf("2 - Edit - Hours Worked\n"); printf("3 - Edit - Expenditures\n"); printf("4 - Edit - Current Interest\n"); printf("5 - Edit - Savings Menu\n"); printf("6 - Quit\n"); scanf("%d",&menu); switch(menu) //Another switch structure { case 1: printf("How much do you make an hour: "); scanf("%d",&PricePerHour); done=false; break; case 2: printf("How many hours do you work a week? (1-168): "); scanf("%d",&HoursWorked); if ((HoursWorked <= 0) || (HoursWorked >= 168)) { printf("Your Number was Invalid. Please enter a Number between (1-168):"); scanf("%d",&HoursWorked); } done=false; break; case 3: printf("How much money do you plan on spending Weekly? "); scanf("%d",&MoneySpent); if (0 > MoneySpent) { printf("Your Number was Invalid. A Positive Number Please: "); scanf("%d",&MoneySpent); } done=false; break; case 4: printf("What is the Current Interest Rate? "); scanf("%d",&CI); if (0 > CI) { printf("Your Number was Invalid. A Positive Number Please: "); scanf("%d",&CI); } done=false; break; case 5: { printf("\\t Menu - Savings\n"); printf("1 - Years\n"); printf("2 - Edit Account Balance\n"); printf("3 - Millionare"); printf("4 - Quit"); scanf("%d",&menu); switch(menu) { case 1: printf("How Many Years would you like to have the total savings calculated for\n"); printf("(Any Number Greater then 1, 0 if You dont Wish To use this option):"); scanf("%d",userc); done=false; break; case 2: printf("What is the Current Balance of Your Account? \\n"); printf("(Any Number Greater then 1, 0 if You dont Wish To use this option): \\n"); scanf("%f",&startbalance); done=false; break; case 3: printf("Type 1, if you would like to calculate the time needed to become a millionare."); printf("0 for No."); scanf("%d",&million); if (million=1) {millionare=true;} else {millionare=false;} done = false; case 4: done=true; break; default: printf("You Have Enter an Invalid Choice. "); done=false; break; done=false; break; } case 6: done=true; break; default: printf("You Have Enter an Invalid Choice. "); done=false; % Link to comment Share on other sites More sharing options...
0 Andre S. Veteran Posted January 22, 2009 Veteran Share Posted January 22, 2009 (edited) Ran your code and played a bit with it, but I didn't get that crash. How do you reproduce it ? Also, VS2008's level 4 warnings reveal that : Warning 14 warning C4101: 'WeekMoneyMade' : unreferenced local variable 10 Warning 15 warning C4101: 'MoneySpentI' : unreferenced local variable 10 Warning 16 warning C4101: 'MoneyLeftOver' : unreferenced local variable 10 Warning 17 warning C4101: 'settings_complete' : unreferenced local variable Warning 18 warning C4101: 'MoneyMade' : unreferenced local variable 10 Warning 19 warning C4101: 'Total' : unreferenced local variable 10 Warning 20 warning C4101: 'Years' : unreferenced local variable 9 Warning 21 warning C4101: 'Y' : unreferenced local variable 9 Warning 22 warning C4101: 'Hours' : unreferenced local variable 9 Warning 23 warning C4101: 'Hour' : unreferenced local variable 9 Warning 24 warning C4101: 'MoneyLeft' : unreferenced local variable 10 Warning 25 warning C4706: assignment within conditional expression 13 Warning 26 warning C4706: assignment within conditional expression 112 Warning 27 warning C4702: unreachable code 127 Warning 28 warning C4700: uninitialized local variable 'userc' used 95 Edited January 22, 2009 by Dr_Asik Link to comment Share on other sites More sharing options...
0 Andre S. Veteran Posted January 22, 2009 Veteran Share Posted January 22, 2009 Oh, well whenever you do scanf(%d, variable) instead of scanf(%d, &variable), you will get the run-time failure, as warning #28 reveals. Does that address your problem ? Link to comment Share on other sites More sharing options...
0 Tech God Posted January 23, 2009 Share Posted January 23, 2009 (edited) Asik you said you read C++ primer... you should be able to pick up the blatant mistakes. for starters, in one of your cases you have a random brace, and no ending code for the entire program. You are also using = for comparison when == is the comparison operator (unless you are just doing this for an endless loop, in which case you could just use while(1) ). In ANSI, main is always an int, not void. You are embedding switches in other switches, some don't even have defaults.... and you are making a switch for 1 value? what the hell is the point. look at this... default: printf("You Have Enter an Invalid Choice. "); done=false; break; done=false; break; i mean what the hell??? this code won't even compile. At least paste ALL the code so we can debug it. it is clearly missing a lot. This code is a mess... I'll look at it again later. Edited January 23, 2009 by Tech God Link to comment Share on other sites More sharing options...
0 nickichl Posted January 23, 2009 Author Share Posted January 23, 2009 well, basically, i have to use Cprogramming, and microsoft visual studio 2005 is the programme i MUST use. i have to use scanf and printf, i cant use cout or cin. which is stupid. my homework has to consist of something to do with compounded interest, using switch-case, for and while loop, if-else. =/ and yes, i cant seem to get it running as well. the deadline is sunday, like. 00:00 sunday. im going crazy. haha. my friend found the whole code using cout and cin, and seeing if printf and scanf was the same thing, bool wouldnt even work. and this is all the code. it is missing alot, i need ALOT of help. and fast. and i realised that default:printf("You Have Enter an Invalid Choice. "); done=false; break; done=false; break; doesnt make any sense as well. haha. im just a beginner, sorry :( Link to comment Share on other sites More sharing options...
0 Tech God Posted January 23, 2009 Share Posted January 23, 2009 If you give me the C++ code i could probably convert it... Link to comment Share on other sites More sharing options...
0 Andre S. Veteran Posted January 23, 2009 Veteran Share Posted January 23, 2009 Asik you said you read C++ primer... you should be able to pick up the blatant mistakes.The code is just missing a few braces at the end, it's easy to get it to compile. The repeated lines you mention don't prevent compilation, however they trigger warning C4702: unreachable code. Here's the compilable and properly indented code : #include <stdio.h> #include <math.h> #define FALSE 0 #define TRUE 1 void main (void) { int HoursWorked,Hours,Hour,userc,Y,Years,menu,million,done,millionare,settings_complete; float MoneySpent,MoneyMade,MoneyLeftOver,MoneyLeft,MoneySpentI,PricePerHour,startbalance,Total,WeekMoneyMade,CI; while(done = true) //While Loops { printf("This program calculates the compounded interest in each year.\n"); printf("\n Menu \n"); printf("1 - Settings\n"); printf("2 - Account Summary\n"); printf("3 - Quit\n"); printf("******************\n"); printf("Enter Your Choice:"); scanf("%d",&menu); switch(menu) { case 1: printf("\t Menu - Settings\n"); printf("1 - Edit - Money Per Hour\n"); printf("2 - Edit - Hours Worked\n"); printf("3 - Edit - Expenditures\n"); printf("4 - Edit - Current Interest\n"); printf("5 - Edit - Savings Menu\n"); printf("6 - Quit\n"); scanf("%d",&menu); switch(menu) //Another switch structure { case 1: printf("How much do you make an hour: "); scanf("%d",&PricePerHour); done=false; break; case 2: printf("How many hours do you work a week? (1-168): "); scanf("%d",&HoursWorked); if ((HoursWorked <= 0) || (HoursWorked >= 168)) { printf("Your Number was Invalid. Please enter a Number between (1-168):"); scanf("%d",&HoursWorked); } done=false; break; case 3: printf("How much money do you plan on spending Weekly? "); scanf("%d",&MoneySpent); if (0 > MoneySpent) { printf("Your Number was Invalid. A Positive Number Please: "); scanf("%d",&MoneySpent); } done=false; break; case 4: printf("What is the Current Interest Rate? "); scanf("%d",&CI); if (0 > CI) { printf("Your Number was Invalid. A Positive Number Please: "); scanf("%d",&CI); } done=false; break; case 5: { printf("\\t Menu - Savings\n"); printf("1 - Years\n"); printf("2 - Edit Account Balance\n"); printf("3 - Millionare"); printf("4 - Quit"); scanf("%d",&menu); switch(menu) { case 1: printf("How Many Years would you like to have the total savings calculated for\n"); printf("(Any Number Greater then 1, 0 if You dont Wish To use this option):"); scanf("%d",userc); done=false; break; case 2: printf("What is the Current Balance of Your Account? \\n"); printf("(Any Number Greater then 1, 0 if You dont Wish To use this option): \\n"); scanf("%f",&startbalance); done=false; break; case 3: printf("Type 1, if you would like to calculate the time needed to become a millionare."); printf("0 for No."); scanf("%d",&million); if (million=1) {millionare=true;} else {millionare=false;} done = false; case 4: done=true; break; default: printf("You Have Enter an Invalid Choice. "); done=false; break; done=false; break; } case 6: done=true; break; default: printf("You Have Enter an Invalid Choice. "); done=false; } } } } } Yes, there are several issues, and Visual Studio's warnings, which I posted, are enough to point them out. To enable level 4 warnings, right-click your project, go to properties->C/C++->General->Warning Level and set it at 4. Link to comment Share on other sites More sharing options...
0 Andre S. Veteran Posted January 23, 2009 Veteran Share Posted January 23, 2009 my friend found the whole code using cout and cin, and seeing if printf and scanf was the same thing, bool wouldnt even work. and this is all the code. it is missing alot, i need ALOT of help. and fast.For bool in C, you can use : typedef enum { FALSE, TRUE } boolean; ... boolean b; Link to comment Share on other sites More sharing options...
0 tiagosilva29 Posted January 23, 2009 Share Posted January 23, 2009 For bool in C, you can use : typedef enum { FALSE, TRUE } boolean; ... boolean b; Or stdbool.h Link to comment Share on other sites More sharing options...
0 nickichl Posted January 24, 2009 Author Share Posted January 24, 2009 its still coming back with errors though, i probably need to convert it from C++ to C, =/ Link to comment Share on other sites More sharing options...
0 Andre S. Veteran Posted January 24, 2009 Veteran Share Posted January 24, 2009 its still coming back with errors though, i probably need to convert it from C++ to C, =/To compile as C in Visual Studio, go to your project properties (right-click project -> properties), now under Configuration Properties, open C/C++. Select Advanced, and set "Compile As" to "Compile as C Code". Click ok and rebuild.You should get 15 errors or so about using 'true' and 'false' in your code, instead of your macros TRUE and FALSE. Link to comment Share on other sites More sharing options...
0 nickichl Posted January 24, 2009 Author Share Posted January 24, 2009 well i changed it from that to that, now the errors that appear are the bool variables and the "cout.setf(ios::fixed)". what can i do? Link to comment Share on other sites More sharing options...
0 Andre S. Veteran Posted January 24, 2009 Veteran Share Posted January 24, 2009 I don't see any mention of cout in the code you posted. In any case, you can't use cout in C, use the standard C functions instead, such as printf. Now, at the beginning of your code you have defined two macros : TRUE and FALSE. So... use them instead of true and false. If you have delcared any variable as 'bool' (I don't see that in the code you provided), you can simply replace bool by int. Alternatively, you can declare a boolean type yourself, as I mentioned previously. If your teachers have you use functionality that do not compile in C, such as cout, that means you are expected to compile your code as C++. Often what teachers mean by "C" is "C++ without object-orientation", and they have students use C++ specific functionality, such as the iostream library. Link to comment Share on other sites More sharing options...
0 nickichl Posted January 24, 2009 Author Share Posted January 24, 2009 This is the new code im working on, after i did all this, the error "C2065: 'true' : undeclared identifier" came out, same thing with False.how do i replace this? "cout.unsetf(ios::fixed)" #include <stdio.h> //Allows formatting of numbers #include <stdlib.h> //Allows DOS Commands (I only use "CLS" to clear the screen) #define False 0 #define True 1 // Function Prototypes typedef enum { FALSE, TRUE } boolean; //They do not return a value void print_settings(); void print_savings(); void print_summary(); void print_calculations(); void print_millionare(); // Global Variables /*Im going to use these to prevent the need to pass by reference/value it would only make this program more confusing */ //Integers //Int short allows for large numbers int short HoursWorked; int short Hours; int short Hour; int short userc; int short Y; int short Years; //Float-Point Variables //Float data type allows for numbers with decimals float MoneySpent; float MoneyMade; float MoneyLeftOver; float MoneyLeft; float MoneySpentI; float PricePerHour; float startbalance; float Total; float WeekMoneyMade; float CI; // boolean Variables int menu; boolean done; boolean settings_complete; boolean millionare; //Allows for True / False int main () { // Local Variables while(done != true) //While Loops { //Main Menu printf("\\t Menu \\t"); printf("1 - Settings"); printf("2 - Account Summary"); printf("3 - Quit"); scanf_s("%d",&menu); //Cins the users choice switch(menu) { case 1: //If the user enters 1 this is executed print_settings(); //Calls the Function settings_complete = true; done=false; //Keeps the loop going break; //Use these between cases case 2: //If the user enters 2 this is executed // An If/Else Structure if(settings_complete == true) { system("CLS");//Clears the Screen (stdlib.h) print_calculations(); //Calls the Function print_summary(); //Calls the Function } else //If the first statement is untrue this is executed { system("CLS");//Clears the Screen (stdlib.h) printf("Please Edit The Settings Before Choosing this options \n"); printf("***************\n"); } done=false; //Keeps the loop goin break; case 3: //If the user enters 3 this is executed done =true; //Ends the main loop, therefore ending the whole program break; default: //If the user enters any number besides 1,2,3 this is displayed printf("You Have Enter an Invalid Choice.\n"); printf("**************\n"); done=false; break; } } return 0; //When the compiler reads this statement the program will end } //Void Function void print_settings() { // Local Variables boolean done; int menu; do { system("CLS"); //Clears the Screen (stdlib.h) printf("\t Menu - Settings"); printf("1 - Edit - Money Per Hour"); printf("2 - Edit - Hours Worked"); printf("3 - Edit - Expenditures"); printf("4 - Edit - Current Interest"); printf("5 - Edit - Savings Menu"); printf("6 - Quit"); scanf_s("%d",&menu); switch(menu) //Another switch structure { case 1: printf("How much do you make an hour: "); scanf_s("%d",&PricePerHour); system("CLS");//Clears the Screen (stdlib.h) done=false; break; case 2: printf("How many hours do you work a week? (1-168): "); scanf_s("%d",&HoursWorked); system("CLS");//Clears the Screen (stdlib.h) // Check For Invalid Entrys// || stands for "OR" //So if Hours worked is <= 0 or Hours worked is >= 168 then the statement //Is executed if ((HoursWorked <= 0) || (HoursWorked >= 168)) { printf("Your Number was Invalid. Please enter a Number between (1-168):"); scanf_s("%d",&HoursWorked); } done=false; break; case 3: printf("How much money do you plan on spending Weekly? "); scanf_s("%d",&MoneySpent); printf("**************\n"); // Check For Invalid Entrys if (0 > MoneySpent) { printf("Your Number was Invalid. A Positive Number Please: \n"); scanf_s("%d",&MoneySpent); } done=false; break; case 4: printf("What is the Current Interest Rate?\n"); scanf_s("%d",&CI); printf("**************\n"); // Check For Invalid Entrys if (0 > CI) { printf("Your Number was Invalid. A Positive Number Please:\n"); scanf_s("%d",&CI); //Cins a positive number for Interest rate } done=false; break; case 5: print_savings(); //Calls the Function done=false; printf("**************\n"); break; case 6: done=true; system("CLS");//Clears the Screen (stdlib.h) break; default: printf("You Have Enter an Invalid Choice. "); done=false; printf("**************\n"); break; } }while (done!=true); } void print_savings() { // Local Variables boolean done; int menu; int million; do { system("CLS"); printf("\t Menu - Savings\n"); printf("1 - Years\n"); printf("2 - Edit Account Balance\n"); printf("3 - Millionare\n"); printf("4 - Quit\n"); scanf_s("%d",&menu); switch(menu) { case 1: printf("How Many Years would you like to have the total savings calculated for\n"); printf("(Any Number Greater then 1, 0 if You dont Wish To use this option): \n"); scanf_s("%d",&userc); done=false; break; case 2: printf("What is the Current Balance of Your Account? \n"); printf("(Any Number Greater then 1, 0 if You dont Wish To use this option): \n"); scanf_s("%d",&startbalance); done=false; break; case 3: printf("Type 1, if you would like to calculate the time needed to become a millionare.\n"); printf("0 for No."); scanf_s("%d",&million); if (million==1) {millionare=true;} else {millionare=false;} done = false; case 4: done=true; break; default: printf("You Have Enter an Invalid Choice.\n"); done=false; break; } } while(done!=true); } void print_calculations() { if (millionare==true) { print_millionare(); } else { // Local Variables int short Y; int short Z; float X; float Xvariable; float Yvariable; //Calculations // Calculates Total Hours Worked During the Year Hours = HoursWorked * 56; Hour = HoursWorked; // This then Calculate How Much Money Was made (Weekly & Yearly) MoneyMade = PricePerHour * Hours; WeekMoneyMade = PricePerHour * Hour; // Simply calculation the money spent to a yearly value MoneySpentI = MoneySpent * 56; // Calculates the Net Profit (Weekly & Yearly) MoneyLeftOver = MoneyMade - MoneySpentI; MoneyLeft= WeekMoneyMade -MoneySpent; // Initializes Required Variables For the Following Calculations X = MoneyLeftOver; Z = 0; Y = 0; //This is set to zero because you dont have a salary before the year begins //But because of the loop the value after one loop is increased by 1(Y++) Years = 0; Yvariable = MoneyLeftOver; Xvariable = startbalance; // Annual Interest (Salary) do { Yvariable = ((Y * MoneyLeftOver) * CI) + X; Y++; Years++; } while (userc != Y + 1); // Annual Interest (Initial Bank Balance) do { Xvariable = ((Z * startbalance) * CI); Z++; } while (userc != Z + 1); // Account Balance plus the sum of the salary balance; Total = Yvariable + Xvariable; } } void print_summary() { boolean done; int choice; int menu; do { printf("\t Menu - Account Summary"); printf("1 - Current Summary"); printf("2 - Quit"); scanf_s("%d",&menu); system("CLS"); switch(menu) { case 1: cout.setf(ios::fixed); printf("\t Summary\n"); printf("Weekly\n"); printf("Hours Worked: %d \n",&HoursWorked); printf("Profit: $&d \n",&MoneyLeft); printf("*************\n"); printf("Yearly\n"); printf("Hours Worked:%d ",&Hours); printf("Profit: $%d",&MoneyLeftOver); printf("*************\n"); printf("Savings\n"); printf("After %d year(s) of saving, your current balance is: $%d",&userc,&Total); printf("*************\n"); if(millionare==true) { printf("It Will Take: %d Years to Save a Million Dollars.",&Years); } cout.unsetf(ios::fixed); printf("Return to the Main Menu (1 for Yes, 0 for No): "); scanf_s("%d",&choice); if(choice == 1) { done = true; //Ends the Loop system("CLS");//Clears the Screen (stdlib.h) } else { done = false; //Keeps Loop Going system("CLS");//Clears the Screen (stdlib.h) } break; case 2: done=true; system("CLS");//Clears the Screen (stdlib.h) break; default: printf("You Have Enter an Invalid Choice.\n"); done=false; break; } } while(done != true); } void print_millionare() { // Local Variables int short Y; int short Z; float X; float Xvariable; float Yvariable; //Calculations // Calculates Total Hours Worked During the Year Hours = HoursWorked * 56; Hour = HoursWorked; // This then Calculate How Much Money Was made (Weekly & Yearly) MoneyMade = PricePerHour * Hours; WeekMoneyMade = PricePerHour * Hour; // Simply calculation the money spent to a yearly value MoneySpentI = MoneySpent * 56; // Calculates the Net Profit (Weekly & Yearly) MoneyLeftOver = MoneyMade - MoneySpentI; MoneyLeft= WeekMoneyMade -MoneySpent; // Initializes Required Variables For the Following Calculations X = MoneyLeftOver; Z = 0; //Control Variable for the second statement Y = 0; //Control Variable for the first statement Years = 0; //You dont make money before you begin the year, but after the loop goes around once //The value is increased to 1 Yvariable = MoneyLeftOver; //Transfers the value to another variable to prevent a change to the main variable Xvariable = startbalance; //See Above // Annual Interest (Salary) do //A do/while loop { Yvariable = ((Y * MoneyLeftOver) * CI) + X; Y++; Years++; } while (userc != Y + 1); // Annual Interest (Initial Bank Balance) do { Xvariable = ((Z * startbalance) * CI); Z++; } while (userc != Z + 1); // Account Balance plus the sum of the salary balance; Total = Yvariable + Xvariable; } Link to comment Share on other sites More sharing options...
0 Andre S. Veteran Posted January 24, 2009 Veteran Share Posted January 24, 2009 This is the new code im working on, after i did all this, the error "C2065: 'true' : undeclared identifier" came out, same thing with False.how do i replace this?"cout.unsetf(ios::fixed)" You seem undecided on what method to use to represent booleans. First you have the macros #define True 0 #define False 0 But you never use these macros in your code, instead you use the C++ keywords true and false, which have no meaning in C. Also you define a boolean type : typedef enum { FALSE, TRUE } boolean; And you do declare variables of this type, which is consistent : boolean done; boolean settings_complete; boolean millionare; //Allows for True / False The problem is, again, that you then compare them with 'true' or 'false' which you do not define and do not exist as keywords in C. If you declare a variable of your custom enum boolean type, compare them with FALSE or TRUE as these are the values you have defined in the enum. Alternatively, you can declare them as int and just use your macros 'True' and 'False'. Use one or the other method, but not both as it would be confusing. I suggest you remove the macros and just keep the custom boolean type. As for using cout, in C, you CAN'T. Just remove those lines. What were their purpose anyway since you're using printf for display ? Link to comment Share on other sites More sharing options...
0 PricklyPoo Posted January 24, 2009 Share Posted January 24, 2009 nickichl...can you try indenting your code like Dr Asik did so it's a little easier to read? Link to comment Share on other sites More sharing options...
0 ekw Posted January 24, 2009 Share Posted January 24, 2009 Please realize that true and false can be 1 or 0 respectively. your while function, while(done=true) is probably doing what you don't want it to do. Your always assigning it to true, thus while(1) is in effect. (perhaps you wanted while(done==true) while(done) will be more eloquent, ofcourse with done being assigned 0 at the beginning. Haven't read the rest of the code for issues, goodluck. Link to comment Share on other sites More sharing options...
0 nickichl Posted January 24, 2009 Author Share Posted January 24, 2009 nickichl...can you try indenting your code like Dr Asik did so it's a little easier to read? what do you mean by this? i dont understand sorry i just started learning Cprogramming, also, the original code is at http://www.cyberarmy.net/library/article/161 so if anyone knows how i can turn it into a C type project it would be appreciated, because right now its in C++, and i dont know how to convert it properly, thanks :D Link to comment Share on other sites More sharing options...
0 Andre S. Veteran Posted January 25, 2009 Veteran Share Posted January 25, 2009 (edited) Unless I am mistaken, your homework consists in making a program for compounding interest in C. You have found an example in C++ on the web, copy-pasted it and wonder how to make it compatible with C. If that's the case, I can't encourage you in that approach, because it will defeat the purpose of the homework, which is probably to make yourself more familiar with the C programming language. You also risk getting 0 or worse (suspended, put to death, etc.) for plagiarism. Start a fresh new project in Visual Studio, make it compile as C, and try to write it entirely yourself using the C standard librairies. Obviously, C++ code that uses C++-specific features such as the C++ standard librairies (iostream, string, etc.) and the bool type won't compile as C, you'd need to learn the differences between the two languages to be able to do the conversion. You don't seem to know much about either language however, so you'd better do the program from scratch in C and worry about C++ later. Edited January 25, 2009 by Dr_Asik Link to comment Share on other sites More sharing options...
Question
nickichl
Hi i'm new to C programming, and i have this homework which i need to do on compounding interest, i would like to know whats wrong.
it says, "Run-Time Check Failure #3 - The variable 'HoursWorked' is being used without being initialized." same with other variables.
below is my code. Please help me! Help appreciated :D
oh, and im using microsoft visual studio 2005, school default, cant upgrade. settings used its general settings.
Link to comment
Share on other sites
18 answers to this question
Recommended Posts