BorderGame
Come posso fare? - Versione stampabile

+- BorderGame (https://www.bordergame.it)
+-- Forum: Programmazione (/Forum-Programmazione--158)
+--- Forum: Programmazione (/Forum-Programmazione)
+---- Forum: C, C# & C++ (/Forum-C-C-C)
+---- Discussione: Come posso fare? (/Thread-Come-posso-fare)



Come posso fare? - Ð3V!L - 05-07-2012 10:00 PM

ITALIANO:

Raga ho un problema col c++..

se io utilizzo il ciclo for per decryptare il pacchetto del login di nostale il contenuto della stringa login_packet rimane solamente nel ciclo for..

mi sorge una domanda:

come posso fare per utilizzare questo contenuto al di fuori del ciclo for?

esempio:

Codice:
std :: string str;
for (...) {
...
str = "ciao"; / / Ho una stringa
}
/ / Come chiamo stringa al di fuori del ciclo for?
std :: cout << str; / / errore, la stringa = "";

chiedo aiuto a chi si intende piu di me in questo passaggio Big Grin

INGLESE:

i have a C++ problem..

if i use the cycle for to decrypt the nostale login package, the content of the string login_packet remains only in the cycle for ...

cycle for = for( ; ; ){...}

i have a question:

how i use this content outside the cycle for?

example:

Codice:
std::string str;
for(...){
...
str = "hello"; // i have a string
}
// how call string outside the cycle for?
std::cout << str; // error, the string = "";



RE: Come posso fare? - Narutomega96 - 06-07-2012 09:51 AM

Basta che dichiari la variabile a fuori dal ciclo for


RE: Come posso fare? - Ð3V!L - 06-07-2012 11:30 AM

Risolto,
il problema era che il ciclo for ogni volta aggiornava la stringa con una lettera diversa e la stampava tipo cosi:

N
o
S
0
5

eccettera.. ho corretto l'errore si puo chiudere Big Grin


RE: Come posso fare? - Angius2644 - 11-07-2012 04:53 PM

Segnalo chiusura


RE: Come posso fare? - Diedarrow13 - 11-07-2012 04:54 PM

@[Angius]
Noi vediamo chi segnala, quindi evitate di scrivere anche nei post.
Closed