struct problem

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jul 2008
Posts: 60
Reputation: gispe is an unknown quantity at this point 
Solved Threads: 0
gispe gispe is offline Offline
Junior Poster in Training

Re: struct problem

 
0
  #11
Aug 26th, 2008
code is:

  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:

  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?
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 376
Reputation: Clockowl is on a distinguished road 
Solved Threads: 27
Clockowl's Avatar
Clockowl Clockowl is offline Offline
Posting Whiz

Re: struct problem

 
0
  #12
Aug 26th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 978
Reputation: mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice 
Solved Threads: 208
mitrmkar mitrmkar is offline Offline
Posting Shark

Re: struct problem

 
0
  #13
Aug 26th, 2008
Originally Posted by gispe View Post
  1. int _tmain(int argc, char* argv[])
and the errors are:
  1. Linking...
  2. LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
You have to #include <tchar.h>
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 60
Reputation: gispe is an unknown quantity at this point 
Solved Threads: 0
gispe gispe is offline Offline
Junior Poster in Training

Re: struct problem

 
0
  #14
Aug 26th, 2008
the code is:


  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. }
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: struct problem

 
0
  #15
Aug 26th, 2008
> local variable 'legajo' used without having been initialized
Pay attention to these as well!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC