|
Mostrar Temas
|
Páginas: 1 2 [3] 4 5 6 7 8 9
|
21
|
Programación / Programación C/C++ / problema asm
|
en: 30 Diciembre 2013, 00:55 am
|
hola amigos como esta, como pasaron la navidad? ojala que bien bueno mi problema es el siguiente datos previos: visual studio 2012 procesador intel core i5 x64 preparación del proyecto cambio de win 32 a 64 personalización de compilación marcar masm para proyectos chicos estaba bien, ahora cuando hago este proyecto, el cual obtuve de http://www.youtube.com/watch?v=kQc85ci6BRk&list=PL0C5C980A28FEE68Dme sale el siguiente error >Compilación iniciada a las 29/12/2013 20:11:01. 1>Main.obj : error LNK2019: símbolo externo ZerroArray sin resolver al que se hace referencia en la función main 1>C:\Users\Administrador\Documents\Visual Studio 2012\ConsoleApplication5\x64\Debug\ConsoleApplication5.exe : fatal error LNK1120: 1 externos sin resolver 1> 1>ERROR al compilar. 1> y me canse de buscarle la vuelta aca los code main.cpp #include<iostream> #include<stdlib.h>
#include "ZerroArray.h" using namespace std;
int main () { int count =1024; char *arr=new char [count];
for (int i = 0; i < count; i++) { arr[i]=(char)rand(); } for (int j = 0; j < count; j++) { cout<<(int)arr[j]<<" "; }
ZerroArray(arr, count*sizeof(char));
for (int k = 0; k < count; k++) { cout<<(int) arr [k]<<" " ; }
cin.get(); delete[] arr; return 0; } ZerroArray.h #ifndef ZERROARRAY_H #define ZERROARRAY_H extern "C" void ZerroArray(void *arr, int countInBytes);
#endif
y ZerroArray.asm .code ZerroArray proc cmp edx, 0 jle Finished
cmp edx, 1 je SetFinalByte
mov ax, 0 mov r8d, edx shr edx,1
MainLoop: mov word ptr [rcx], ax add rcx,2 dec edx jnz MainLoop
and r8d,1 jz Finished
SetFinalByte: mov byte prt [rcx],0
Finished: ret ZerroArray endp end
|
|
|
22
|
Programación / Bases de Datos / importar fecha
|
en: 21 Octubre 2013, 04:10 am
|
hola bueno, mi problema es ese trato de importar de un archivo txt entre otros datos la fecha, el problema es que esta en formato dd/mm/yyyy y mysql usa yyyy/mm/dd he visto varios ejemplos pero solo es usando INSERT INTO....y yo lo que quiero es hacerlo en 26.000 registros, me volveria chino, como puedo hacerlo todo en un solo paso...alli el codigo que llevo haciendo create table Bco( Entidad smallint, Sucursal smallint, Cuenta mediumint, Gaf smallint, TipodeDoc varchar(5), Documento int not null, NombreBeneficiario varchar (50), Mov smallint, Fecha date, Detalle varchar(30), Localidad varchar(30), TipodeMoneda tinyint, Importe double(10,2)); load data local infile 'C:/Bco.txt' into table bco FIELDS TERMINATED BY ';'lines terminated by '\n';
select * from Bco;
|
|
|
24
|
Programación / Programación C/C++ / errores varios
|
en: 5 Octubre 2013, 04:43 am
|
bueno, no le encuentro solución, si alguno me ayuda estaría genial, acá el code y su log donde están los errores es visual c++ 2012 // ver1.1.cpp: define el punto de entrada de la aplicación de consola. //
#include "stdafx.h" /* examples/standalone_example_docs1.cpp */ /* Standard C++ includes */ #include <stdlib.h> #include <iostream>
/* Include directly the different headers from cppconn/ and mysql_driver.h + mysql_util.h (and mysql_connection.h). This will reduce your build time! */ #include "mysql_connection.h" #include <cppconn/driver.h> #include <cppconn/exception.h> #include <cppconn/resultset.h> #include <cppconn/statement.h>
#pragma comment(lib,"mysqlcppconn.lib") #pragma comment(lib,"libmysql.lib")
using namespace std; int main(void) { cout << endl; cout << "Running 'SELECT 'Hello World!' AS _message'..." << endl; try { sql::Driver *driver; sql::Connection *con; sql::Statement *stmt; sql::ResultSet *res; /* Create a connection */ driver = get_driver_instance(); con = driver->connect("tcp://127.0.0.1:3306", "root", "root"); /* Connect to the MySQL test database */ con->setSchema("test"); stmt = con->createStatement(); res = stmt->executeQuery("SELECT 'Hello World!' AS _message"); while (res->next()) { cout << "\t... MySQL replies: "; /* Access column data by alias or column name */ cout << res->getString("_message") << endl; cout << "\t... MySQL says it again: "; /* Access column fata by numeric offset, 1 is the first column */ cout << res->getString(1) << endl; } delete res; delete stmt; delete con; } catch (sql::SQLException &e) { cout << "# ERR: SQLException in " << __FILE__; cout << "(" << __FUNCTION__ << ") on line " << __LINE__ << endl; cout << "# ERR: " << e.what(); cout << " (MySQL error code: " << e.getErrorCode(); cout << ", SQLState: " << e.getSQLState() << " )" << endl; } cout << endl; return EXIT_SUCCESS; }
log Compilación iniciada a las 04/10/2013 23:26:24. 1>Proyecto "C:\Users\Administrador\Documents\Visual Studio 2012\ver1.1\ver1.1\ver1.1.vcxproj" en el nodo 2 (Build destinos). 1>Link: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"C:\Users\Administrador\Documents\Visual Studio 2012\ver1.1\Release\ver1.1.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files\MySQL\Connector C++ 1.1.3\lib\opt" /LIBPATH:"C:\Program Files\MySQL\MySQL Server 5.6\lib" mysqlcppconn.lib libmysql.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:\Users\Administrador\Documents\Visual Studio 2012\ver1.1\Release\ver1.1.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Users\Administrador\Documents\Visual Studio 2012\ver1.1\Release\ver1.1.lib" /MACHINE:X86 /SAFESEH Release\stdafx.obj Release\ver1.1.obj 1>ver1.1.obj : error LNK2001: símbolo externo __imp__get_driver_instance sin resolver 1>ver1.1.obj : error LNK2001: símbolo externo "__declspec(dllimport) public: int __thiscall sql::SQLException::getErrorCode(void)const " (__imp_?getErrorCode@SQLException@sql@@QBEHXZ) sin resolver 1>ver1.1.obj : error LNK2001: símbolo externo "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __thiscall sql::SQLException::getSQLState(void)const " (__imp_?getSQLState@SQLException@sql@@QBEABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) sin resolver 1>ver1.1.obj : error LNK2001: símbolo externo "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __thiscall sql::SQLString::asStdString(void)const " (__imp_?asStdString@SQLString@sql@@QBEABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) sin resolver 1>ver1.1.obj : error LNK2001: símbolo externo "__declspec(dllimport) public: __thiscall sql::SQLString::SQLString(char const * const)" (__imp_??0SQLString@sql@@QAE@QBD@Z) sin resolver 1>ver1.1.obj : error LNK2001: símbolo externo "__declspec(dllimport) public: __thiscall sql::SQLString::~SQLString(void)" (__imp_??1SQLString@sql@@QAE@XZ) sin resolver 1>C:\Users\Administrador\Documents\Visual Studio 2012\ver1.1\Release\ver1.1.exe : fatal error LNK1120: 6 externos sin resolver 1>Compilación del proyecto terminada "C:\Users\Administrador\Documents\Visual Studio 2012\ver1.1\ver1.1\ver1.1.vcxproj" (Build destinos) -- ERROR.
ERROR al compilar.
Tiempo transcurrido 00:00:00.18
|
|
|
25
|
Programación / Programación C/C++ / no abre un archivo txt [solucionado]
|
en: 2 Octubre 2013, 05:31 am
|
hola como están, bueno la verdad esta duda surge que por leer el tema de uno de los chicos decidí trabajar con archivos pero en c++, se supone es un txt que tiene nombres separados por comas, la cuestión es que siempre salta al final y no me da un resultado, error" #include<iostream> #include<fstream> #include<string>
using namespace std;
int main() { string linea; string nombre; char a=','; cout<<"ingrese el nombre buscado"<<endl; getline(cin, nombre); ifstream miArchivo ("nombres.txt"); if (miArchivo.is_open()) { while (getline(miArchivo, linea,a )) { if (nombre==linea) { cout<<"el nombre buscado esta presente "<<endl; } else { cout<<"el nombre no esta"<<endl; } } miArchivo.close(); } else { cout<<"algo paso"<<endl; } getchar(); return 0; }
|
|
|
26
|
Programación / Programación C/C++ / ahorcado
|
en: 19 Agosto 2013, 19:48 pm
|
hace bastante que no le entraba a c++, bueno y era un tema pendiente el juego del ahorcado...esta hecho para windows...capaz ahí se podría mejorar un poco para mejorar...bue allí el código así me dan propuestas para mejorarlo #include<iostream> #include<string> #include<Windows.h>
using namespace std;
int main () { string palabra; string solucion; int i=0, intentos=0; signed int tamano; char a; cout<<"ingrese la palabra "<<endl; getline(cin, palabra); //inicio de juego system("cls"); cout<<"como ayuda la palabra tiene "<<palabra.size()<<" letras"<<endl; tamano=palabra.size(); //llenar de asteriscos la solucion
for (int i = 0; i <= tamano-1; i++) { solucion+='+'; } cout<<solucion<<endl; //comprobacion cout<<"el numero de intentos debe ser superior al numero de letras"<<endl; cout<<"ingrese los intentos"<<endl; cin>>intentos; system("cls"); //inicio while (intentos>=0) { cout<<"ingrese la letra: "<<endl; cin>>a; for (int i = 0; i <= tamano-1; i++) { if (palabra[i]==a) { solucion[i]=a; } } cout<<"hasta ahora la palabra es "<<solucion<<endl; intentos--; cout<<"los intentos hasta ahora es "<<intentos; Sleep(3000); system("cls"); if (palabra==solucion) { cout<<"FELICIDADES GANASTE :) :) "<<solucion<<endl; }; if (intentos==1) { cout<<"solo te queda un intento"<<endl; }; } system("PAUSE"); return 0; }
|
|
|
27
|
Programación / Programación C/C++ / archivo log
|
en: 23 Julio 2013, 03:19 am
|
hola chicos hoy estaba viendo un log que me no supe entender 07-22 09:02:09.643000 : client.cpp(36) : CClientMtm/ConstructL (this: 0x500010 07-22 09:02:09.657000 : client.cpp(95) : CClientMtm/QueryCapability/cap uid: 0x102072b9 07-22 09:02:09.662000 : client.cpp(42) : CClientMtm/dtor (this: 0x500010 07-22 17:14:03.312000 : client.cpp(36) : CClientMtm/ConstructL (this: 0x50f280 07-22 17:14:03.315000 : client.cpp(95) : CClientMtm/QueryCapability/cap uid: 0x102072b9 07-22 17:14:03.316000 : client.cpp(42) : CClientMtm/dtor (this: 0x50f280 07-22 17:14:13.521625 : uidata.cpp(51) : CUiDataMtm/ConstructL 07-22 17:14:13.788000 : uidata.cpp(62) : CUiDataMtm/GetResourceFileName 07-22 17:14:14.166625 : uidata.cpp(84) : CUiDataMtm/QueryCapability/cap: 0x10001378 07-22 17:14:14.168625 : uidata.cpp(84) : CUiDataMtm/QueryCapability/cap: 0x10001373 07-22 17:14:14.183875 : uidata.cpp(84) : CUiDataMtm/QueryCapability/cap: 0x10001374 07-22 17:14:14.189875 : uidata.cpp(84) : CUiDataMtm/QueryCapability/cap: 0x10001376 07-22 17:14:14.190875 : uidata.cpp(84) : CUiDataMtm/QueryCapability/cap: 0x10001375 07-22 17:14:14.192875 : uidata.cpp(84) : CUiDataMtm/QueryCapability/cap: 0x10001630 07-22 17:14:14.192875 : uidata.cpp(84) : CUiDataMtm/QueryCapability/cap: 0x101fd692 07-22 17:14:14.193875 : uidata.cpp(134) : CUiDataMtm/CanCreateEntryL 07-22 17:14:14.194875 : uidata.cpp(57) : CUiDataMtm/dtor 07-22 17:18:51.072375 : client.cpp(36) : CClientMtm/ConstructL (this: 0x727220 07-22 17:18:51.093750 : ui.cpp(46) : CUiMtm/ConstructL 07-22 17:18:51.095750 : ui.cpp(59) : CUiMtm/GetResourceFileName 07-22 17:18:51.102750 : ui.cpp(68) : CUiMtm/QueryCapability/cap uid: 0x1000484e 07-22 17:18:51.110750 : ui.cpp(74) : CUiMtm/InvokeSyncFunctionL/id: 2097154 07-22 17:18:51.112750 : ui.cpp(41) : CUiMtm/dtor 07-22 17:18:51.116750 : client.cpp(42) : CClientMtm/dtor (this: 0x727220 07-22 17:18:59.325875 : procmgrserver.cpp(600) : ### Process Manager: Starting ... (pid: 488) 07-22 17:18:59.374875 : procmgrserver.cpp(612) : ### Process Manager: Started 07-22 17:18:59.450500 : procmgrserver.cpp(324) : ### Starting app startup timer (6 secs) ... 07-22 17:19:05.473750 : procmgrserver.cpp(396) : ### Process Manager: Timer expired, Starting app. ### 07-22 17:19:05.489750 : procmgrserver.cpp(496) : ***CProcMgrServer::HandleError - error starting app: -1 07-22 17:19:16.694500 : client.cpp(36) : CClientMtm/ConstructL (this: 0x500010 07-22 17:19:16.697500 : client.cpp(95) : CClientMtm/QueryCapability/cap uid: 0x102072b9 07-22 17:19:16.698500 : client.cpp(42) : CClientMtm/dtor (this: 0x500010 07-22 17:19:16.906250 : client.cpp(36) : CClientMtm/ConstructL (this: 0x51b680 07-22 17:19:16.908250 : client.cpp(95) : CClientMtm/QueryCapability/cap uid: 0x102072b9 07-22 17:19:16.909250 : client.cpp(42) : CClientMtm/dtor (this: 0x51b680 07-22 17:46:30.703375 : client.cpp(36) : CClientMtm/ConstructL (this: 0x51e960 07-22 17:46:30.708375 : client.cpp(95) : CClientMtm/QueryCapability/cap uid: 0x102072b9 07-22 17:46:30.709375 : client.cpp(42) : CClientMtm/dtor (this: 0x51e960 07-22 17:50:10.112375 : client.cpp(36) : CClientMtm/ConstructL (this: 0x520740 07-22 17:50:10.115375 : client.cpp(95) : CClientMtm/QueryCapability/cap uid: 0x102072b9 07-22 17:50:10.116375 : client.cpp(42) : CClientMtm/dtor (this: 0x520740 07-22 18:07:24.316500 : client.cpp(36) : CClientMtm/ConstructL (this: 0x726ff8 07-22 18:07:24.352125 : ui.cpp(46) : CUiMtm/ConstructL 07-22 18:07:24.358125 : ui.cpp(59) : CUiMtm/GetResourceFileName 07-22 18:07:24.366375 : ui.cpp(68) : CUiMtm/QueryCapability/cap uid: 0x1000484e 07-22 18:07:24.371375 : ui.cpp(74) : CUiMtm/InvokeSyncFunctionL/id: 2097154 07-22 18:07:24.382000 : ui.cpp(41) : CUiMtm/dtor 07-22 18:07:24.395000 : client.cpp(42) : CClientMtm/dtor (this: 0x726ff8 07-22 18:07:35.224500 : procmgrserver.cpp(600) : ### Process Manager: Starting ... (pid: 495) 07-22 18:07:35.291000 : procmgrserver.cpp(612) : ### Process Manager: Started 07-22 18:07:35.390000 : procmgrserver.cpp(324) : ### Starting app startup timer (6 secs) ... 07-22 18:07:41.448500 : procmgrserver.cpp(396) : ### Process Manager: Timer expired, Starting app. ### 07-22 18:07:41.489375 : procmgrserver.cpp(496) : ***CProcMgrServer::HandleError - error starting app: -1 07-22 18:07:49.276625 : client.cpp(36) : CClientMtm/ConstructL (this: 0x500010 07-22 18:07:49.281625 : client.cpp(95) : CClientMtm/QueryCapability/cap uid: 0x102072b9 07-22 18:07:49.283625 : client.cpp(42) : CClientMtm/dtor (this: 0x500010 07-22 18:07:49.546250 : client.cpp(36) : CClientMtm/ConstructL (this: 0x51b680 07-22 18:07:49.548250 : client.cpp(95) : CClientMtm/QueryCapability/cap uid: 0x102072b9 07-22 18:07:49.550250 : client.cpp(42) : CClientMtm/dtor (this: 0x51b680 07-22 18:12:26.525625 : client.cpp(36) : CClientMtm/ConstructL (this: 0x5207d0 07-22 18:12:26.527625 : client.cpp(95) : CClientMtm/QueryCapability/cap uid: 0x102072b9 07-22 18:12:26.528625 : client.cpp(42) : CClientMtm/dtor (this: 0x5207d0 07-22 19:21:01.687875 : client.cpp(36) : CClientMtm/ConstructL (this: 0x726ff8 07-22 19:21:01.705875 : ui.cpp(46) : CUiMtm/ConstructL 07-22 19:21:01.709875 : ui.cpp(59) : CUiMtm/GetResourceFileName 07-22 19:21:01.719875 : ui.cpp(68) : CUiMtm/QueryCapability/cap uid: 0x1000484e 07-22 19:21:01.729875 : ui.cpp(74) : CUiMtm/InvokeSyncFunctionL/id: 2097154 07-22 19:21:01.737875 : ui.cpp(41) : CUiMtm/dtor 07-22 19:21:01.748875 : client.cpp(42) : CClientMtm/dtor (this: 0x726ff8 07-22 19:21:21.868750 : procmgrserver.cpp(600) : ### Process Manager: Starting ... (pid: 493) 07-22 19:21:21.875750 : procmgrserver.cpp(612) : ### Process Manager: Started 07-22 19:21:21.880750 : procmgrserver.cpp(324) : ### Starting app startup timer (6 secs) ... 07-22 19:21:27.989625 : procmgrserver.cpp(396) : ### Process Manager: Timer expired, Starting app. ### 07-22 19:21:28.176500 : procmgrserver.cpp(496) : ***CProcMgrServer::HandleError - error starting app: -1 07-22 19:21:39.342125 : client.cpp(36) : CClientMtm/ConstructL (this: 0x500010 07-22 19:21:39.347125 : client.cpp(95) : CClientMtm/QueryCapability/cap uid: 0x102072b9 07-22 19:21:39.348125 : client.cpp(42) : CClientMtm/dtor (this: 0x500010 07-22 19:21:39.682875 : client.cpp(36) : CClientMtm/ConstructL (this: 0x51b680 07-22 19:21:39.683875 : client.cpp(95) : CClientMtm/QueryCapability/cap uid: 0x102072b9 07-22 19:21:39.684875 : client.cpp(42) : CClientMtm/dtor (this: 0x51b680 07-22 21:10:57.529875 : uidata.cpp(51) : CUiDataMtm/ConstructL 07-22 21:10:57.533875 : uidata.cpp(62) : CUiDataMtm/GetResourceFileName 07-22 21:10:57.543875 : uidata.cpp(84) : CUiDataMtm/QueryCapability/cap: 0x101fd692 07-22 21:10:57.544875 : uidata.cpp(84) : CUiDataMtm/QueryCapability/cap: 0x10008b24 07-22 21:37:52.062875 : uidata.cpp(57) : CUiDataMtm/dtor 07-22 21:38:34.552500 : client.cpp(36) : CClientMtm/ConstructL (this: 0x726ff8 07-22 21:38:34.566500 : ui.cpp(46) : CUiMtm/ConstructL 07-22 21:38:34.568500 : ui.cpp(59) : CUiMtm/GetResourceFileName 07-22 21:38:34.577500 : ui.cpp(68) : CUiMtm/QueryCapability/cap uid: 0x1000484e 07-22 21:38:34.579500 : ui.cpp(74) : CUiMtm/InvokeSyncFunctionL/id: 2097154 07-22 21:38:34.581500 : ui.cpp(41) : CUiMtm/dtor 07-22 21:38:34.585500 : client.cpp(42) : CClientMtm/dtor (this: 0x726ff8 07-22 21:39:11.393375 : procmgrserver.cpp(600) : ### Process Manager: Starting ... (pid: 506) 07-22 21:39:11.431375 : procmgrserver.cpp(612) : ### Process Manager: Started 07-22 21:39:11.509000 : procmgrserver.cpp(324) : ### Starting app startup timer (6 secs) ... 07-22 21:39:17.516625 : procmgrserver.cpp(396) : ### Process Manager: Timer expired, Starting app. ### 07-22 21:39:17.521625 : procmgrserver.cpp(496) : ***CProcMgrServer::HandleError - error starting app: -1 07-22 21:39:32.119000 : client.cpp(36) : CClientMtm/ConstructL (this: 0x500070 07-22 21:39:32.128000 : client.cpp(95) : CClientMtm/QueryCapability/cap uid: 0x102072b9 07-22 21:39:32.134000 : client.cpp(42) : CClientMtm/dtor (this: 0x500070 07-22 21:39:32.368250 : client.cpp(36) : CClientMtm/ConstructL (this: 0x51c440 07-22 21:39:32.370250 : client.cpp(95) : CClientMtm/QueryCapability/cap uid: 0x102072b9 07-22 21:39:32.371250 : client.cpp(42) : CClientMtm/dtor (this: 0x51c440 07-22 21:42:44.169125 : client.cpp(36) : CClientMtm/ConstructL (this: 0x726ff8 07-22 21:42:44.185125 : ui.cpp(46) : CUiMtm/ConstructL 07-22 21:42:44.190125 : ui.cpp(59) : CUiMtm/GetResourceFileName 07-22 21:42:44.198125 : ui.cpp(68) : CUiMtm/QueryCapability/cap uid: 0x1000484e 07-22 21:42:44.202125 : ui.cpp(74) : CUiMtm/InvokeSyncFunctionL/id: 2097154 07-22 21:42:44.206125 : ui.cpp(41) : CUiMtm/dtor 07-22 21:42:44.214125 : client.cpp(42) : CClientMtm/dtor (this: 0x726ff8 07-22 21:43:10.143000 : procmgrserver.cpp(600) : ### Process Manager: Starting ... (pid: 502) 07-22 21:43:10.202875 : procmgrserver.cpp(612) : ### Process Manager: Started 07-22 21:43:10.276375 : procmgrserver.cpp(324) : ### Starting app startup timer (6 secs) ... 07-22 21:43:16.285250 : procmgrserver.cpp(396) : ### Process Manager: Timer expired, Starting app. ### 07-22 21:43:16.289250 : procmgrserver.cpp(496) : ***CProcMgrServer::HandleError - error starting app: -1 07-22 21:43:25.447375 : client.cpp(36) : CClientMtm/ConstructL (this: 0x500040 07-22 21:43:25.450375 : client.cpp(95) : CClientMtm/QueryCapability/cap uid: 0x102072b9 07-22 21:43:25.451375 : client.cpp(42) : CClientMtm/dtor (this: 0x500040 07-22 21:43:25.672625 : client.cpp(36) : CClientMtm/ConstructL (this: 0x51bd00 07-22 21:43:25.674625 : client.cpp(95) : CClientMtm/QueryCapability/cap uid: 0x102072b9 07-22 21:43:25.675625 : client.cpp(42) : CClientMtm/dtor (this: 0x51bd00 07-22 21:50:53.937500 : client.cpp(36) : CClientMtm/ConstructL (this: 0x726ff8 07-22 21:50:53.955500 : ui.cpp(46) : CUiMtm/ConstructL 07-22 21:50:53.957500 : ui.cpp(59) : CUiMtm/GetResourceFileName 07-22 21:50:53.961500 : ui.cpp(68) : CUiMtm/QueryCapability/cap uid: 0x1000484e 07-22 21:50:53.963500 : ui.cpp(74) : CUiMtm/InvokeSyncFunctionL/id: 2097154 07-22 21:50:53.964500 : ui.cpp(41) : CUiMtm/dtor 07-22 21:50:53.973500 : client.cpp(42) : CClientMtm/dtor (this: 0x726ff8 07-22 21:51:24.456375 : procmgrserver.cpp(600) : ### Process Manager: Starting ... (pid: 504) 07-22 21:51:24.495375 : procmgrserver.cpp(612) : ### Process Manager: Started 07-22 21:51:24.556375 : procmgrserver.cpp(324) : ### Starting app startup timer (6 secs) ... 07-22 21:51:30.585125 : procmgrserver.cpp(396) : ### Process Manager: Timer expired, Starting app. ### 07-22 21:51:30.590125 : procmgrserver.cpp(496) : ***CProcMgrServer::HandleError - error starting app: -1 07-22 21:51:37.110875 : client.cpp(36) : CClientMtm/ConstructL (this: 0x500410 07-22 21:51:37.113875 : client.cpp(95) : CClientMtm/QueryCapability/cap uid: 0x102072b9 07-22 21:51:37.115875 : client.cpp(42) : CClientMtm/dtor (this: 0x500410 07-22 21:51:37.349000 : client.cpp(36) : CClientMtm/ConstructL (this: 0x51b3d0 07-22 21:51:37.351000 : client.cpp(95) : CClientMtm/QueryCapability/cap uid: 0x102072b9 07-22 21:51:37.352000 : client.cpp(42) : CClientMtm/dtor (this: 0x51b3d0
|
|
|
28
|
Programación / Programación C/C++ / llenar string con algo
|
en: 17 Junio 2013, 02:08 am
|
hola gente tengo una duda ...quiero llenar un string con algo y me sale este error expession string subscript out of range #include<iostream> #include<string>
using namespace std;
int main () { string uno; string dos; signed int tamano; cout<<"ingrese uno "<<endl; getline(cin, uno); tamano=uno.size(); for (int i = 0; i <= tamano-1; i++) { dos[i]='+'; } .....etc etc etc....... return 0; }
la otra q probe pero sale el mismo error es ]#include<iostream> #include<string>
using namespace std;
int main () { string uno; string dos; signed int tamano; cout<<"ingrese uno "<<endl; getline(cin, uno); for (int i = 0; i <=uno.size(); i++) { dos[i]='+'; }
|
|
|
29
|
Programación / Programación C/C++ / clase racional
|
en: 9 Abril 2013, 05:57 am
|
hola amigos, tengo este problema y ya me maree bastante si alguno me puede echar una mano seria genial, programo en visual 2012 c++ "programar en c++ de deitel " problema n° 9.6 dice cree una clase llamada racional para realizar operaciones aritmeticas con fracciones escriba un programa para evaluar su clase. use variables enteras para representar los datos private de la clase:numerador y denominador. Proporcione un constructor que permita a un objeto de esta clase inicializarse cuando se declare. El constructor debe tener valores prederminados en caso de que no se proporcione inicializaodres y debe almacenar una fracion en forma reducida. Por ejemplo la fracion 2/4 se se almacena en el objeto como 1/2.Proporcione funciones mienbro public que realizen cada una de las siguientes tareas sumar restar multiplicar dividir imprimir fraciones en modfo a/b y en forma de punto flotante mi code es // Racional.h #ifndef RACIONAL_H #define RACIONAL_H
#pragma once
using namespace System;
namespace Racional {
public ref class miRacional { // TODO: agregar aquí los métodos de la clase. public: miRacional(int , int ); ~miRacional(); //funciones void suma(); void resta(); void multiplicar(); void dividir(); void ImprimirFraccion(); void ImprimirFlotante(); int reducir(int, int); private: int numerador; int denominador; }; } #endif y // Archivo DLL principal. //racional.cpp
#include "stdafx.h"
#include "Racional.h"
#include<iostream> using std::cout; using std::cin; using std::endl; using std::fixed;
#include<iomanip> using std::setprecision;
Racional::miRacional::miRacional(int num, int deno) { numerador=denominador=1; reducir(int num, int deno); }
int Racional::miRacional::reducir(int n, int d ) { int i; for (int i = 2; i <= 11; i++) { while ((d%i==0)&&(n%i==0)) { d=d/i; n=n/i; } } return d,n; }
void Racional::miRacional::suma() { int n1,d1,n2,d2; cout<<"ingrese numerador y denominador de 1° fraccion"; cin>>n1,d1; cout<<"ingrese numerador y denominador de 2° fraccion"; cin>>n2,d2; numerador=((n1*d2)+(d1*n2)); denominador=(d1*d2); }
void Racional::miRacional::resta() { int n1,d1,n2,d2; cout<<"ingrese numerador y denominador de 1° fraccion"; cin>>n1,d1; cout<<"ingrese numerador y denominador de 2° fraccion"; cin>>n2,d2; denominador=(d1*d2); numerador=((d2*n1)-(d1*n2)); }
void Racional::miRacional::multiplicar() { int n1,d1,n2,d2; cout<<"ingrese numerador y denominador de 1° fraccion"; cin>>n1,d1; cout<<"ingrese numerador y denominador de 2° fraccion"; cin>>n2,d2; numerador=(n1*n2); denominador=(d1*d2); }
void Racional::miRacional::dividir() { int n1,d1,n2,d2; cout<<"ingrese numerador y denominador de 1° fraccion"; cin>>n1,d1; cout<<"ingrese numerador y denominador de 2° fraccion"; cin>>n2,d2; numerador=n1*d2; denominador=d1*n2; }
void Racional::miRacional::ImprimirFraccion() { cout<<"el resultado es "<<numerador<<"/"<<denominador<<endl; system("PAUSE"); }
void Racional::miRacional::ImprimirFlotante() { double a; a=static_cast<double>(numerador)/denominador; cout<<"el resultado de la fraccion en decimales es"<< setprecision(5)<<fixed<<a; system("PAUSE"); }
el problema me lo da el constructor para reducir una fracion aca los errores 1>------ Operación Compilar iniciada: proyecto: Racional, configuración: Debug Win32 ------ 1> Racional.cpp 1>Racional.cpp(19): error C2144: error de sintaxis : 'int' debe estar precedido de ')' 1>Racional.cpp(19): error C2660: 'Racional::miRacional::reducir' : la función no acepta 0 argumentos 1>Racional.cpp(19): error C2059: error de sintaxis : ')' ========== Compilar: 0 correctos, 1 incorrectos, 0 actualizados, 0 omitidos ==========
|
|
|
30
|
Programación / Programación C/C++ / manejo de archivos txt
|
en: 11 Febrero 2013, 21:58 pm
|
hola amigos bueno a sucedido algo raro mientras trataba de ahcer algo con el manejo de archivos txt. tengo un txt que tiene nombres de ciudades y finaliza con un 1 deberia darme solo ese trozo desde el nombre hasta el 1 londres blablablabla 1 paris blablablabla 1 roma blablabla 1 compila de diez, pero ejecuto y me sale un mensaje... Unhandled exception at at 0x7634C41F in carta.exe: Microsoft C++ exception: std::out_of_range at memory location 0x0015F4EC. aca el codigo #include <iostream> #include <fstream> #include <string>
using namespace std;
string carga_archivo (string nombre) { string linea; ifstream miarchivo; miarchivo.open(nombre); if(!miarchivo.good()) { cout << "Error abriendo archivo"; return "ERROR"; }
while(!miarchivo.eof()) { getline(miarchivo, linea); } miarchivo.close();
return linea; }
string ubicar_copiar(string leer_texto ) { string frase, pedazo; int aux=1; int posicion1, posicion2; cout<<"ingrese ciudad " <<endl; cin >>frase; posicion1=leer_texto.find(frase); posicion2=leer_texto.find(aux,posicion1); pedazo=leer_texto.substr (posicion1,posicion2); return pedazo; }
int main() { string texto, importante; texto=carga_archivo("ciudad.txt"); importante=ubicar_copiar(texto); cout<<importante<<endl; cin.get(); return 0; }
|
|
|
|
|
|
|