need help with c++ program

Discussion in 'Programming' started by CustomiZer, Jan 5, 2010.

  1. #1
    I need to write a c++ program on a quiz with files and static memory allocation.

    can someone help me..?:confused:
     
    CustomiZer, Jan 5, 2010 IP
  2. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I'll see whether I can help you if you could describe the project.
     
    NeoCambell, Jan 6, 2010 IP
  3. CustomiZer

    CustomiZer Peon

    Messages:
    141
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    CustomiZer, Jan 6, 2010 IP
  4. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Little bit of a long piece of code :)

    However what are the problems you have?
     
    NeoCambell, Jan 6, 2010 IP
  5. CustomiZer

    CustomiZer Peon

    Messages:
    141
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    too many errors...not able to debug it..:(

    you think it is too long...?
     
    CustomiZer, Jan 6, 2010 IP
  6. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #6
    This is written to compile on a legacy C compiler like Turbo C or Borland C.
    You will have to convert so that you could compile with a current C/C++ compiler like Visual C.

    For example, clrscr, gotoxy like functions are no longer supported in modern compilers.

    Hope this helps.
     
    NeoCambell, Jan 6, 2010 IP
  7. CustomiZer

    CustomiZer Peon

    Messages:
    141
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I used borland to edit the codes
     
    CustomiZer, Jan 6, 2010 IP
  8. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Turbo C will work.... Which version of Borland C you use (I'm sure you are not talking about Windows based Borland IDEs like C Builder, etc... You need to use a legacy one... say Borlance C 3.0)
     
    NeoCambell, Jan 6, 2010 IP
  9. CustomiZer

    CustomiZer Peon

    Messages:
    141
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I'm using Windows based Borland IDE

    can someone help debugg this ?
     
    CustomiZer, Jan 6, 2010 IP
  10. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I had a look at your code. Problem is very clear as you are trying to compile a legacy C code (which was developed using either Turbo C or Borland C 3.0-) on a new compiler which is not compatible straight away.

    You need to change the functions like gotoxy, clrscr to Windows specific functions.

    For example: gotoxy can be implemented as below.

    #include <windows.h> 
    void gotoxy(int x, int y){
       COORD coord; 
       coord.X = x; coord.Y = y; 
       SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_H ANDLE), coord); 
    }
    Code (markup):
    If you clear out all those incompatibilities due to legacy C codes in your file, it will get compiled without any problem.

    When you receive the error list after trying to compile, you can google the first error, fix it and so on.
    Or else you will have to get a C coder to sort this out for you.
     
    NeoCambell, Jan 6, 2010 IP
  11. CustomiZer

    CustomiZer Peon

    Messages:
    141
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    can you please do it for me....I need this very badly in an hour or so.....

    if you want anything in exchange feel free to ask...

    please...please
     
    CustomiZer, Jan 6, 2010 IP
  12. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #12
    I'm sorry to say that your code is an unprofessionally written code.
    So you will have to do lots of alignment work, etc...

    Code is getting compiled now also working at least on the options that I have tried. I have also included Visual C++ project files.

    When it comes to helping someone who is in trouble, I do not expect anything other than friendship.
     

    Attached Files:

    • test.zip
      File size:
      13.6 KB
      Views:
      108
    NeoCambell, Jan 6, 2010 IP
  13. CustomiZer

    CustomiZer Peon

    Messages:
    141
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    thank you very much for your help...

    I would need the code to run on turbo c++.

    the file you have attached...could you explain that..? did you change the program codes ?


    the errors now :

    
    while (toupper(an)=='Y')                        //implicit declaration of function 'int toupper(...)'            line-113
    
    id1 = NULL;                                         //converting NULL to non-pointer type                          line-146
    
    flushall();                                            //implicit declaration of function 'int flushall(...)'              line-175
    
    unlink ("TEMP.DAT");                             //implicit declaration of function 'int unlink(...)'                line-509
    
    qualify = nrec * (0.75);                         //assignment of int to double                                       line-1271 
    
    fcloseall();                                          //implicit declaration of function 'int fcloseall(...)'             line-1656    
    
    Code (markup):
     
    Last edited: Jan 6, 2010
    CustomiZer, Jan 6, 2010 IP
  14. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #14
    I didn't study functionality wise as it takes more than a day...
    I just fixed the compiler problems. I didn't change program codes... just commented out incompatible codes and added new line char to some printf.
     
    NeoCambell, Jan 6, 2010 IP
  15. CustomiZer

    CustomiZer Peon

    Messages:
    141
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    thanks a ton for your help !

    I'll be waiting for your corrected codes
     
    CustomiZer, Jan 6, 2010 IP
  16. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #16
    On Visual C++ 6, this is all okay.
    However I'm not sure why this "implicit...." error is coming when all these functions are coming from header files that are defined above the routines.

    Sorry I couldn't help further as I do not have your compiler to reproduce the same error.

    Please post the Borland compiler you use so someone else from this forum will try to assist you.
     
    NeoCambell, Jan 6, 2010 IP
  17. CustomiZer

    CustomiZer Peon

    Messages:
    141
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #17
    I just changed my compiler..and I got these errors...

    now I'm using c- free 4
     
    CustomiZer, Jan 7, 2010 IP
  18. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #18
    What are the errors you get now?
     
    NeoCambell, Jan 8, 2010 IP
  19. CustomiZer

    CustomiZer Peon

    Messages:
    141
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #19
    while (toupper(an)=='Y')                        //implicit declaration of function 'int toupper(...)'            line-113
    
    id1 = NULL;                                         //converting NULL to non-pointer type                          line-146
    
    flushall();                                            //implicit declaration of function 'int flushall(...)'              line-175
    
    unlink ("TEMP.DAT");                             //implicit declaration of function 'int unlink(...)'                line-509
    
    qualify = nrec * (0.75);                         //assignment of int to double                                       line-1271 
    
    fcloseall();                                          //implicit declaration of function 'int fcloseall(...)'             line-1656
    Code (markup):
     
    CustomiZer, Jan 9, 2010 IP
  20. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #20
    Can you use Dev C++ which is free and let me know what you get.

    Download link.

    You must use a standard compiler.
     
    NeoCambell, Jan 9, 2010 IP