943,666 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 1420
  • C++ RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Aug 26th, 2008
0

Re: struct problem

code is:

C++ Syntax (Toggle Plain Text)
  1. // maximo_ventas.cpp : Defines the entry point for the console application.
  2.  
  3. //
  4.  
  5.  
  6.  
  7. #include "stdafx.h"
  8. #include <iostream>
  9. #include <vector>
  10.  
  11.  
  12. using namespace std;
  13.  
  14.  
  15.  
  16. void ingresar_gente ();
  17. void comparar_datos (int vendedor[]);
  18.  
  19.  
  20.  
  21. int _tmain(int argc, char* argv[])
  22. {
  23. int vendedor[10];
  24.  
  25. ingresar_gente ();
  26. comparar_datos (vendedor);
  27.  
  28. system ("PAUSE");
  29.  
  30. return 0;
  31. }
  32.  
  33.  
  34.  
  35.  
  36. void ingresar_gente ()
  37. {
  38. int i = 0, legajo;
  39. float total_ventas;
  40.  
  41. while (i < 10)
  42. {
  43. cout << " Ingrese un legajo: ";
  44. cin >> legajo;
  45.  
  46. i++;
  47.  
  48. while (legajo != 0)
  49. {
  50. cout << " Ingrese la cantidad de ventas hechas: ";
  51. cin >> total_ventas;
  52. }
  53. }
  54.  
  55. }
  56.  
  57.  
  58.  
  59. void comparar_datos (int vendedor[])
  60. {
  61. float aux, total_ventas;
  62. int i, legajo;
  63.  
  64. for (i = 1; i < 10; i++)
  65. {
  66. if (total_ventas >= aux)
  67. {
  68. aux = total_ventas;
  69. cout << legajo;
  70. }
  71. }
  72.  
  73. }


and the errors are:

C++ Syntax (Toggle Plain Text)
  1. --------------------Configuration: maximo_ventas - Win32 Debug--------------------
  2. Compiling...
  3. maximo_ventas.cpp
  4. C:\Documents and Settings\pm11218\ejercicios c++\maximo_ventas\maximo_ventas.cpp(66) : warning C4700: local variable 'total_ventas' used without having been initialized
  5. C:\Documents and Settings\pm11218\ejercicios c++\maximo_ventas\maximo_ventas.cpp(69) : warning C4700: local variable 'legajo' used without having been initialized
  6. Linking...
  7. LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
  8. Debug/maximo_ventas.exe : fatal error LNK1120: 1 unresolved externals
  9. Error executing link.exe.
  10.  
  11. maximo_ventas.exe - 2 error(s), 2 warning(s)


and yes, im usin visual c++ 6.0
now, tinkin.. the version has somethin to do with this or is somethin else?
Reputation Points: 6
Solved Threads: 0
Junior Poster in Training
gispe is offline Offline
74 posts
since Jul 2008
Aug 26th, 2008
0

Re: struct problem

I said

int main

not

int _tmain

EDIT: That might sound a bit harsh. No hard feelings, it's just what I said.
Last edited by Clockowl; Aug 26th, 2008 at 11:04 am.
Reputation Points: 69
Solved Threads: 28
Posting Whiz
Clockowl is offline Offline
376 posts
since May 2008
Aug 26th, 2008
0

Re: struct problem

Click to Expand / Collapse  Quote originally posted by gispe ...
C++ Syntax (Toggle Plain Text)
  1. int _tmain(int argc, char* argv[])
and the errors are:
C++ Syntax (Toggle Plain Text)
  1. Linking...
  2. LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
You have to #include <tchar.h>
Reputation Points: 1105
Solved Threads: 389
Posting Virtuoso
mitrmkar is offline Offline
1,714 posts
since Nov 2007
Aug 26th, 2008
0

Re: struct problem

the code is:


C++ Syntax (Toggle Plain Text)
  1.  
  2. // maximo_ventas.cpp : Defines the entry point for the console application.
  3.  
  4. //
  5.  
  6.  
  7.  
  8. #include "stdafx.h"
  9. #include <iostream>
  10. #include <vector>
  11.  
  12.  
  13. using namespace std;
  14.  
  15.  
  16.  
  17. void ingresar_gente ();
  18. void comparar_datos (int vendedor[]);
  19.  
  20.  
  21.  
  22. int _tmain(int argc, char* argv[])
  23. {
  24. int vendedor[10];
  25.  
  26. ingresar_gente ();
  27. comparar_datos (vendedor);
  28.  
  29. system ("PAUSE");
  30.  
  31. return 0;
  32. }
  33.  
  34.  
  35.  
  36.  
  37. void ingresar_gente ()
  38. {
  39. int i = 0, legajo;
  40. float total_ventas;
  41.  
  42. while (i < 10)
  43. {
  44. cout << " Ingrese un legajo: ";
  45. cin >> legajo;
  46.  
  47. i++;
  48.  
  49. while (legajo != 0)
  50. {
  51. cout << " Ingrese la cantidad de ventas hechas: ";
  52. cin >> total_ventas;
  53. }
  54. }
  55.  
  56. }
  57.  
  58.  
  59.  
  60. void comparar_datos (int vendedor[])
  61. {
  62. float aux, total_ventas;
  63. int i, legajo;
  64.  
  65. for (i = 1; i < 10; i++)
  66. {
  67. if (total_ventas >= aux)
  68. {
  69. aux = total_ventas;
  70. cout << legajo;
  71. }
  72. }
  73.  
  74. }
Reputation Points: 6
Solved Threads: 0
Junior Poster in Training
gispe is offline Offline
74 posts
since Jul 2008
Aug 26th, 2008
0

Re: struct problem

> local variable 'legajo' used without having been initialized
Pay attention to these as well!
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Heap Corruption??!! Help!!!
Next Thread in C++ Forum Timeline: socket programming





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC