elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Curso de javascript por TickTack


  Mostrar Mensajes
Páginas: 1 ... 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 [237] 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 ... 279
2361  Programación / Scripting / Re: Variable incremental dentro de un FOR en: 22 Julio 2009, 19:27 pm
Código
  1. @echo off
  2. set var1=hola
  3. set var2=pepe
  4. set var3=test
  5. set var4=chau
  6. for /L %%i IN (1, 1, 4) DO (
  7. echo ********************   Aguarde un instante por favor        
  8. set name=var%%i
  9. call echo %%var%%i%%
  10. )

Salida:
Código:
********************   Aguarde un instante por favor
hola
********************   Aguarde un instante por favor
pepe
********************   Aguarde un instante por favor
test
********************   Aguarde un instante por favor
chau
2362  Programación / Programación C/C++ / Re: necesito hacer la codificacion en c++ en: 22 Julio 2009, 04:16 am
Ya que estas podrias usar los cin y cout, si solo usas la i en un for puedes declararla dentro del for

for(int i=0;....

donde tienes struct ¿No seria typedef struct?


struct alumnos programacion[MAX]; --> se hace fuera del main dentro del main declararas una variable de ese tipo aunque tampoco es lo recomendable, lo mas recomendable seria que usaras programacion orientada a objetos o yo lo veo asi, con una clase alumnos y luego tendras la clase gestorvectoralumnos. En el principal haces las llamadas al gestor segun te convenga.

Lo del convenio si es verdad las constantes en mayusculas podrias usar en vez de #define MAX 5 esto--> const int MAX=5;
Pero se ve claramente que lo queire en C y se confundió al poner C++.
2363  Programación / Programación C/C++ / Re: necesito hacer la codificacion en c++ en: 22 Julio 2009, 03:35 am
Tenías muchos errores.

Código
  1. #include<stdio.h>
  2. #define MAX 5
  3. struct alumnos
  4. {
  5. char nombre[10];
  6. char apellido[10];
  7. char direccion[20];
  8. char profesion[30];
  9. char lugar_nacimiento[20];
  10. int cedula;
  11. int edad;
  12. int telefono;
  13. };
  14. int main(void)
  15. {
  16. struct alumnos programacion[MAX];
  17. int i;
  18. for(i=0;i<MAX;i++)
  19. {
  20. printf("nombre del alumno:\n\t");
  21. scanf("%s",programacion[i].nombre);
  22. printf("apellido del alumno %s : \n\t", programacion[i].nombre);
  23. scanf("%s",programacion[i].apellido);
  24. printf("direccion del alumno %s :\n\t", programacion[i].nombre);
  25. scanf("%s",programacion[i].direccion);
  26. printf("profesion del alumno %s:\n\t", programacion[i].nombre);
  27. scanf("%s",programacion[i].profesion);
  28. printf("lugar de nacimiento del alumno %s : \n\t", programacion[i].nombre);
  29. scanf("%s",programacion[i].lugar_nacimiento);
  30. printf("cedula del alumno %s :\n\t", programacion[i].nombre);
  31. scanf("%d", &programacion[i].cedula);
  32. printf("edad del alumno %s : \n\t", programacion[i].nombre);
  33. scanf("%d", &programacion[i].edad);
  34. printf("telefono del alumno %s : \n\t", programacion[i].nombre);
  35. scanf("%d", &programacion[i].telefono);
  36. printf("\n\n");
  37. }
  38. for(i=0;i<MAX;i++)
  39. {
  40. printf("%s",programacion[i].nombre);
  41. printf("\t\t\%s",programacion[i].apellido);
  42. printf("\t\t\%s",programacion[i].direccion);
  43. printf("\t\t\%s",programacion[i].profesion);
  44. printf("\t\t\%s",programacion[i].lugar_nacimiento);
  45. printf("\t\t\%d",programacion[i].cedula);
  46. printf("\t\t\%d",programacion[i].edad);
  47. printf("\t\t\%d",programacion[i].telefono);
  48. printf("\n");
  49. }
  50. while(getchar() != '\n');
  51. return 0;
  52. }
  53.  

No necesitas "conio.h" para pausar el programa, podrías usar:
Código:
while(getchar() != '\n');
getchar();
Para pausarlo.
Aqui:
Código:
int cedula[10];
int edad[2];
int telefono[15];

No necesitas declararlo como array, ya que estas utilizando un array de registros o estructuras.

Aqui:
Código:
int i=0;
for(i=0;i<max;i++)
No necesitas darle el valor a "i" cuando la declaras, ya que luego le darás un valor en el bucle FOR.
Aqui:
Código:
printf("nombre del alumno:\n\t");
scanf("%s",programacion.nombre);
printf("apellido del alumno:\n\t");
scanf("%s",programacion.apellido);
...
Como es un array de registros, necesitas especificar el indice del array, así:
Código:
programacion[indice].campo

Aqui hay un error:
Código:
for(i=i;i<max;i++)
Debió ser:
Código:
for(i = 0; i < max; i++)

Igual aqui:
Código:
printf("%s",programacion.nombre);
printf("t\t\%s",programacion.apellido);
printf("t\t\%s",programacion.direccion);
...
Utilizalo asi:
Código:
programacion[indice].campo
Una cosa más:
Código:
#define max 5
Debería ser :
Código:
#define MAX 5
Esto es solo por convenio, o sea, buena costumbre.

Y otra cosa:
Es C, no C++
Cualquier duda aqui estamos.

2364  Foros Generales / Foro Libre / Re: Edad Promedio de Usuarios del Foro. en: 21 Julio 2009, 18:02 pm
15 ...

14 . . . ;D Debe ser por lo de  Neo al principio del nick ^^

El tema lleva un año sin actividad, por favor, no abras temas viejos.

Leete las reglas.
2365  Programación / Scripting / Re: Bat para mover un archivo de un PC a otro PC en red en: 21 Julio 2009, 03:57 am
Exacto, copy también puede usarse para copiar archivos en red, es decir, sin usar net use.
2366  Programación / Scripting / Re: NET STOP en una máquina en red en: 18 Julio 2009, 04:21 am
Como bien dices, el comando es net stop, aqui tienes documentación al respecto:
Código:
http://www.ss64.com/nt/net.html
2367  Comunicaciones / Hacking Mobile / Re: Gospel descubre grave vulnerabilidad en Bluetooth de teléfonos HTC en: 15 Julio 2009, 23:18 pm
Mis felicitaciones para Gospel.  :)
2368  Programación / Scripting / Re: Nircmd. Porque no funciona nircmd.exe sendkey 0x2D press??? en: 14 Julio 2009, 18:02 pm
Mmmmmmm, yo usaba estos códigos:
Código:
#define VK_OEM_1          0xBA   // ';:' for US

...

#define VK_OEM_2          0xBF   // '/?' for US
#define VK_OEM_3          0xC0   // '`~' for US

...

#define VK_OEM_4          0xDB  //  '[{' for US
#define VK_OEM_5          0xDC  //  '\|' for US
#define VK_OEM_6          0xDD  //  ']}' for US
#define VK_OEM_7          0xDE  //  ''"' for US
#define VK_OEM_8          0xDF

Código:
   public enum KeysEx: byte {
            None                    = 0x00,
            VK_LBUTTON              = Keys.LButton,             // 0x01
            VK_RBUTTON              = Keys.RButton,             // 0x02
            VK_CANCEL               = Keys.Cancel,              // 0x03
            VK_MBUTTON              = Keys.MButton,             // 0x04
            VK_XBUTTON1             = Keys.XButton1,            // 0x05
            VK_XBUTTON2             = Keys.XButton2,            // 0x06
            /*
             * 0x07 : unassigned
             */
            VK_BACK                 = Keys.Back,                // 0x08
            VK_TAB                  = Keys.Tab,                 // 0x09
            /*
             * 0x0A - 0x0B : reserved
             */
            VK_CLEAR                = Keys.Clear,               // 0x0C
            VK_RETURN               = Keys.Return,              // 0x0D, Keys.Enter
            VK_SHIFT                = Keys.ShiftKey,            // 0x10
            VK_CONTROL              = Keys.ControlKey,          // 0x11
            VK_MENU                 = Keys.Menu,                // 0x12
            VK_PAUSE                = Keys.Pause,               // 0x13
            VK_CAPITAL              = Keys.Capital,             // 0x14, Keys.CapsLock
            VK_KANA                 = Keys.KanaMode,            // 0x15
            VK_HANGEUL              = Keys.HanguelMode,         // 0x15, Keys.HangulMode
            VK_JUNJA                = Keys.JunjaMode,           // 0x17
            VK_FINAL                = Keys.FinalMode,           // 0x18
            VK_HANJA                = Keys.HanjaMode,           // 0x19
            VK_KANJI                = Keys.KanjiMode,           // 0x19
            VK_ESCAPE               = Keys.Escape,              // 0x1B
            VK_CONVERT              = Keys.IMEConvert,          // 0x1C
            VK_NONCONVERT           = Keys.IMENonconvert,       // 0x1D
            VK_ACCEPT               = Keys.IMEAceept,           // 0x1E, Keys.IMEAccept
            VK_MODECHANGE           = Keys.IMEModeChange,       // 0x1F
            VK_SPACE                = Keys.Space,               // 0x20
            VK_PRIOR                = Keys.Prior,               // 0x21, Keys.PageUp
            VK_NEXT                 = Keys.Next,                // 0x22, Keys.PageDown
            VK_END                  = Keys.End,                 // 0x23
            VK_HOME                 = Keys.Home,                // 0x24
            VK_LEFT                 = Keys.Left,                // 0x25
            VK_UP                   = Keys.Up,                  // 0x26
            VK_RIGHT                = Keys.Right,               // 0x27
            VK_DOWN                 = Keys.Down,                // 0x28
            VK_SELECT               = Keys.Select,              // 0x29
            VK_PRINT                = Keys.Print,               // 0x2A
            VK_EXECUTE              = Keys.Execute,             // 0x2B
            VK_SNAPSHOT             = Keys.Snapshot,            // 0x2C, Keys.PrintScreen
            VK_INSERT               = Keys.Insert,              // 0x2D
            VK_DELETE               = Keys.Delete,              // 0x2E
            VK_HELP                 = Keys.Help,                // 0x2F
            VK_0                    = Keys.D0,                  // 0x30
            VK_1                    = Keys.D1,                  // 0x31
            VK_2                    = Keys.D2,                  // 0x32
            VK_3                    = Keys.D3,                  // 0x33
            VK_4                    = Keys.D4,                  // 0x34
            VK_5                    = Keys.D5,                  // 0x35
            VK_6                    = Keys.D6,                  // 0x36
            VK_7                    = Keys.D7,                  // 0x37
            VK_8                    = Keys.D8,                  // 0x38
            VK_9                    = Keys.D9,                  // 0x39
            /*
             * 0x40 : unassigned
             */
            VK_A                    = Keys.A,                   // 0x41
            VK_B                    = Keys.B,                   // 0x42
            VK_C                    = Keys.C,                   // 0x43
            VK_D                    = Keys.D,                   // 0x44
            VK_E                    = Keys.E,                   // 0x45
            VK_F                    = Keys.F,                   // 0x46
            VK_G                    = Keys.G,                   // 0x47
            VK_H                    = Keys.H,                   // 0x48
            VK_I                    = Keys.I,                   // 0x49
            VK_J                    = Keys.J,                   // 0x4A
            VK_K                    = Keys.K,                   // 0x4B
            VK_L                    = Keys.L,                   // 0x4C
            VK_M                    = Keys.M,                   // 0x4D
            VK_N                    = Keys.N,                   // 0x4E
            VK_O                    = Keys.O,                   // 0x4F
            VK_P                    = Keys.P,                   // 0x50
            VK_Q                    = Keys.Q,                   // 0x51
            VK_R                    = Keys.R,                   // 0x52
            VK_S                    = Keys.S,                   // 0x53
            VK_T                    = Keys.T,                   // 0x54
            VK_U                    = Keys.U,                   // 0x55
            VK_V                    = Keys.V,                   // 0x56
            VK_W                    = Keys.W,                   // 0x57
            VK_X                    = Keys.X,                   // 0x58
            VK_Y                    = Keys.Y,                   // 0x59
            VK_Z                    = Keys.Z,                   // 0x5A
            VK_LWIN                 = Keys.LWin,                // 0x5B
            VK_RWIN                 = Keys.RWin,                // 0x5C
            VK_APPS                 = Keys.Apps,                // 0x5D
            /*
             * 0x5E : reserved
             */
            VK_SLEEP                = 0x5f,                     // 0x5f, Keys.Sleep
            VK_NUMPAD0              = Keys.NumPad0,             // 0x60
            VK_NUMPAD1              = Keys.NumPad1,             // 0x61
            VK_NUMPAD2              = Keys.NumPad2,             // 0x62
            VK_NUMPAD3              = Keys.NumPad3,             // 0x63
            VK_NUMPAD4              = Keys.NumPad4,             // 0x64
            VK_NUMPAD5              = Keys.NumPad5,             // 0x65
            VK_NUMPAD6              = Keys.NumPad6,             // 0x66
            VK_NUMPAD7              = Keys.NumPad7,             // 0x67
            VK_NUMPAD8              = Keys.NumPad8,             // 0x68
            VK_NUMPAD9              = Keys.NumPad9,             // 0x69
            VK_MULTIPLY             = Keys.Multiply,            // 0x6A
            VK_ADD                  = Keys.Add,                 // 0x6B
            VK_SEPARATOR            = Keys.Separator,           // 0x6C
            VK_SUBTRACT             = Keys.Subtract,            // 0x6D
            VK_DECIMAL              = Keys.Decimal,             // 0x6E
            VK_DIVIDE               = Keys.Divide,              // 0x6F
            VK_F1                   = Keys.F1,                  // 0x70
            VK_F2                   = Keys.F2,                  // 0x71
            VK_F3                   = Keys.F3,                  // 0x72
            VK_F4                   = Keys.F4,                  // 0x73
            VK_F5                   = Keys.F5,                  // 0x74
            VK_F6                   = Keys.F6,                  // 0x75
            VK_F7                   = Keys.F7,                  // 0x76
            VK_F8                   = Keys.F8,                  // 0x77
            VK_F9                   = Keys.F9,                  // 0x78
            VK_F10                  = Keys.F10,                 // 0x79
            VK_F11                  = Keys.F11,                 // 0x7A
            VK_F12                  = Keys.F12,                 // 0x7B
            VK_F13                  = Keys.F13,                 // 0x7C
            VK_F14                  = Keys.F14,                 // 0x7D
            VK_F15                  = Keys.F15,                 // 0x7E
            VK_F16                  = Keys.F16,                 // 0x7F
            VK_F17                  = Keys.F17,                 // 0x80
            VK_F18                  = Keys.F18,                 // 0x81
            VK_F19                  = Keys.F19,                 // 0x82
            VK_F20                  = Keys.F20,                 // 0x83
            VK_F21                  = Keys.F21,                 // 0x84
            VK_F22                  = Keys.F22,                 // 0x85
            VK_F23                  = Keys.F23,                 // 0x86
            VK_F24                  = Keys.F24,                 // 0x87
            /*
             * 0x88 - 0x8F : unassigned
             */
            VK_NUMLOCK              = Keys.NumLock,             // 0x90
            VK_SCROLL               = Keys.Scroll,              // 0x91
            VK_OEM_NEC_EQUAL        = 0x92,                     // 0x92, NEC PC-9800 kbd definition
            VK_OEM_FJ_JISHO         = 0x92,                     // 0x92, Fujitsu/OASYS kbd definition
            VK_OEM_FJ_MASSHOU       = 0x93,                     // 0x93, Fujitsu/OASYS kbd definition
            VK_OEM_FJ_TOUROKU       = 0x94,                     // 0x94, Fujitsu/OASYS kbd definition
            VK_OEM_FJ_LOYA          = 0x95,                     // 0x95, Fujitsu/OASYS kbd definition
            VK_OEM_FJ_ROYA          = 0x96,                     // 0x96, Fujitsu/OASYS kbd definition
            /*
             * 0x97 - 0x9F : unassigned
             */
            VK_LSHIFT               = Keys.LShiftKey,           // 0xA0
            VK_RSHIFT               = Keys.RShiftKey,           // 0xA1
            VK_LCONTROL             = Keys.LControlKey,         // 0xA2
            VK_RCONTROL             = Keys.RControlKey,         // 0xA3
            VK_LMENU                = Keys.LMenu,               // 0xA4
            VK_RMENU                = Keys.RMenu,               // 0xA5
            VK_BROWSER_BACK         = Keys.BrowserBack,         // 0xA6
            VK_BROWSER_FORWARD      = Keys.BrowserForward,      // 0xA7
            VK_BROWSER_REFRESH      = Keys.BrowserRefresh,      // 0xA8
            VK_BROWSER_STOP         = Keys.BrowserStop,         // 0xA9
            VK_BROWSER_SEARCH       = Keys.BrowserSearch,       // 0xAA
            VK_BROWSER_FAVORITES    = Keys.BrowserFavorites,    // 0xAB
            VK_BROWSER_HOME         = Keys.BrowserHome,         // 0xAC
            VK_VOLUME_MUTE          = Keys.VolumeMute,          // 0xAD
            VK_VOLUME_DOWN          = Keys.VolumeDown,          // 0xAE
            VK_VOLUME_UP            = Keys.VolumeUp,            // 0xAF
            VK_MEDIA_NEXT_TRACK     = Keys.MediaNextTrack,      // 0xB0
            VK_MEDIA_PREV_TRACK     = Keys.MediaPreviousTrack,  // 0xB1
            VK_MEDIA_STOP           = Keys.MediaStop,           // 0xB2
            VK_MEDIA_PLAY_PAUSE     = Keys.MediaPlayPause,      // 0xB3
            VK_LAUNCH_MAIL          = Keys.LaunchMail,          // 0xB4
            VK_LAUNCH_MEDIA_SELECT  = Keys.SelectMedia,         // 0xB5
            VK_LAUNCH_APP1          = Keys.LaunchApplication1,  // 0xB6
            VK_LAUNCH_APP2          = Keys.LaunchApplication2,  // 0xB7
            /*
             * 0xB8 - 0xB9 : reserved
             */
            VK_OEM_1                = Keys.OemSemicolon,        // 0xBA, Keys.Oem1
            VK_OEM_PLUS             = Keys.Oemplus,             // 0xBB
            VK_OEM_COMMA            = Keys.Oemcomma,            // 0xBC
            VK_OEM_MINUS            = Keys.OemMinus,            // 0xBD
            VK_OEM_PERIOD           = Keys.OemPeriod,           // 0xBE
            VK_OEM_2                = Keys.OemQuestion,         // 0xBF, Keys.Oem2
            VK_OEM_3                = Keys.Oemtilde,            // 0xC0, Keys.Oem3
            /*
             * 0xC1 - 0xD7 : reserved
             */
            /*
             * 0xD8 - 0xDA : unassigned
             */
            VK_OEM_4                = Keys.OemOpenBrackets,     // 0xDB, Keys.Oem4
            VK_OEM_5                = Keys.OemPipe,             // 0xDC, Keys.Oem5
            VK_OEM_6                = Keys.OemCloseBrackets,    // 0xDD, Keys.Oem6
            VK_OEM_7                = Keys.OemQuotes,           // 0xDE, Keys.Oem7
            VK_OEM_8                = Keys.Oem8,                // 0xDF
            /*
             * 0xE0 : reserved
             */
            VK_OEM_AX               = 0xE1,                     // 0xE1, 'AX' key on Japanese AX kbd
            VK_OEM_102              = Keys.OemBackslash,        // 0xE2, Keys.Oem102
            VK_ICO_HELP             = 0xE3,                     // 0xE3, Help key on ICO
            VK_ICO_00               = 0xE4,                     // 0xE4, 00 key on ICO
            VK_PROCESSKEY           = Keys.ProcessKey,          // 0xE5
            VK_ICO_CLEAR            = 0xE6,                     // 0xE6
            VK_PACKET               = 0xE7,                     // 0xE7, Keys.Packet
            /*
             * 0xE8 : unassigned
             */
            VK_OEM_RESET            = 0xE9,                     // 0xE9, Nokia/Ericsson definition
            VK_OEM_JUMP             = 0xEA,                     // 0xEA, Nokia/Ericsson definition
            VK_OEM_PA1              = 0xEB,                     // 0xEB, Nokia/Ericsson definition
            VK_OEM_PA2              = 0xEC,                     // 0xEC, Nokia/Ericsson definition
            VK_OEM_PA3              = 0xED,                     // 0xED, Nokia/Ericsson definition
            VK_OEM_WSCTRL           = 0xEE,                     // 0xEE, Nokia/Ericsson definition
            VK_OEM_CUSEL            = 0xEF,                     // 0xEF, Nokia/Ericsson definition
            VK_OEM_ATTN             = 0xF0,                     // 0xF0, Nokia/Ericsson definition
            VK_OEM_FINISH           = 0xF1,                     // 0xF1, Nokia/Ericsson definition
            VK_OEM_COPY             = 0xF2,                     // 0xF2, Nokia/Ericsson definition
            VK_OEM_AUTO             = 0xF3,                     // 0xF3, Nokia/Ericsson definition
            VK_OEM_ENLW             = 0xF4,                     // 0xF4, Nokia/Ericsson definition
            VK_OEM_BACKTAB          = 0xF5,                     // 0xF5, Nokia/Ericsson definition
            VK_ATTN                 = Keys.Attn,                // 0xF6
            VK_CRSEL                = Keys.Crsel,               // 0xF7
            VK_EXSEL                = Keys.Exsel,               // 0xF8
            VK_EREOF                = Keys.EraseEof,            // 0xF9
            VK_PLAY                 = Keys.Play,                // 0xFA
            VK_ZOOM                 = Keys.Zoom,                // 0xFB
            VK_NONAME               = Keys.NoName,              // 0xFC
            VK_PA1                  = Keys.Pa1,                 // 0xFD
            VK_OEM_CLEAR            = Keys.OemClear,            // 0xFE
            /*
             * 0xFF : reserved
             */
        }
2369  Programación / Scripting / Re: Nircmd. Porque no funciona nircmd.exe sendkey 0x2D press??? en: 14 Julio 2009, 03:13 am
Por que es un caracter especial, prueba con esto:
Código:
nircmd.exe sendkey 0xBD press
2370  Programación / Scripting / Re: ¿Como copiar un archivo como administrador? en: 9 Julio 2009, 17:58 pm
Si quieres que lo abra aparte o en otra ventana, debes de usar el comando START:
Código:
http://www.ss64.com/nt/start.html
Páginas: 1 ... 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 [237] 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 ... 279
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines