em Posted November 8, 2011 Report Share Posted November 8, 2011 (edited) Pentru ca am vazut ca penultimul meu challenge a fost un esec (doar o persoana a raspuns) am decis sa postez lucruri mult mai scurte.Gigel a decis sa ajute la un proiect open source si a deschis una din sutele de surse. Intr-un fisier a vazut codul. ... if(x==1) cout<<"x este 1, continuam executia "; else cout<<"am primit eroarea "<<x; ...Gigel a compilat sursa si a vazut mesajul "am primit eroarea 1";Cum se poate asa ceva?Raspunsuri prin PM. Comentarii aici.Solvers- AlStar- cifratorul- plm- Nytro- Robert1995- Serar- bogdannbv- Sweby - cea mai originala solutie- anon- Ellimist- adonisslanic- BGS- H3xoR- aphdex- totti93- hit47- DuTy^Closed! Edited November 10, 2011 by em Link to comment Share on other sites More sharing options...
BGS Posted November 9, 2011 Report Share Posted November 9, 2011 Mie oricum as face imi da x este 1, continuam executia, folosesc codeblocks , fac ceva gresit ? Link to comment Share on other sites More sharing options...
plm Posted November 9, 2011 Report Share Posted November 9, 2011 te complici prea mult BGS. nici nu e nevoie sa scrii bucatica de cod. Link to comment Share on other sites More sharing options...
Serar Posted November 9, 2011 Report Share Posted November 9, 2011 am trimis si eu desi prefer php in favoarea C Link to comment Share on other sites More sharing options...
Sweby Posted November 9, 2011 Report Share Posted November 9, 2011 Eu sunt la inceput de c++, si mi se pare usor . Oricum, multumim em pentru challenge . Link to comment Share on other sites More sharing options...
bcman Posted November 10, 2011 Report Share Posted November 10, 2011 Recunosc, habar nu am sa fac Oricum, sper ca atunci cand em va considera challenge-ul inchis sa posteze si rezolvarea. Link to comment Share on other sites More sharing options...
em Posted November 10, 2011 Author Report Share Posted November 10, 2011 (edited) Closed. O solutiechar x='1';Extra:Sweby,aphexint x;x=1.1;totti93#define if (a) if (!(a))Nytro#define x 1<0 Edited November 11, 2011 by em Link to comment Share on other sites More sharing options...
devacanta Posted November 11, 2011 Report Share Posted November 11, 2011 nu prea stiu c++bool x = true; ar fi mers? Link to comment Share on other sites More sharing options...
H3xoR Posted November 11, 2011 Report Share Posted November 11, 2011 (edited) nu prea stiu c++bool x = true; ar fi mers?nu, true are valoarea 1 si false are valoarea 0apropo, aici la char x = 1 nu functioneaza.. trebuie pus 1 intre ghilimele( '1' )............ si nici la int x = 1.1, valoarea absoluta a lui x tot 1 este............ doamne Edited November 11, 2011 by H3xoR Link to comment Share on other sites More sharing options...
Nytro Posted November 11, 2011 Report Share Posted November 11, 2011 em, cred ca vrei sa zici:char x = 49;Adica x e codul ASCII al caracterului '1'. Link to comment Share on other sites More sharing options...
H3xoR Posted November 11, 2011 Report Share Posted November 11, 2011 em, cred ca vrei sa zici:char x = 49;Adica x e codul ASCII al caracterului '1'.asa i-am trimis eu Link to comment Share on other sites More sharing options...
em Posted November 11, 2011 Author Report Share Posted November 11, 2011 (edited) em, cred ca vrei sa zici:char x = 49;Adica x e codul ASCII al caracterului '1'.Am vrut sa zic char x='1'. Cum am dat copy/paste din PM-ul cuiva si prima oara nu s-au copiat ghilimelele. Si pe urma am uitat. Mersi.@H3xoR,Cea cu int x=1.1 merge. Ce compilator folosesti?L.E. : Nu avem doamne pe forum. Edited November 11, 2011 by em Link to comment Share on other sites More sharing options...
nedo Posted November 11, 2011 Report Share Posted November 11, 2011 cea cu int x=1.1 nu merge. Testat pe code blocks 10.05 (gcc 4.4.1) si pe visual c++ 2010Asta inseamna sa gandesti out of the box literalmente , eu m-am gandit doar la acel bloc de cod nu si la variabila Link to comment Share on other sites More sharing options...
expirat Posted November 11, 2011 Report Share Posted November 11, 2011 (edited) gcc version 4.5.3 (Gentoo 4.5.3-r1 p1.0, pie-0.4.5)int x=1.1 nu merge. Insa char x = '1'; da. Un cod corect nu inseamna intotdeauna o particularizare. Edited November 11, 2011 by expirat Link to comment Share on other sites More sharing options...
adonisslanic Posted November 11, 2011 Report Share Posted November 11, 2011 (edited) pai stai, int ( integer ) nu suporta virgulele, deci ar fi ilegal sa scrii 1.1 ca cifra stocata intr-o variabila de tip int .-. Care e logica? pe unele compilatoare merge faza, pe altele nu Edited November 11, 2011 by adonisslanic Link to comment Share on other sites More sharing options...
em Posted November 11, 2011 Author Report Share Posted November 11, 2011 Mie pe g++ 4.6.1 merge. Dar intr-adevar este un abuz de notatie. Am punctat solutia doar pentru ca mi-a mers. Felicitari participantilor. Link to comment Share on other sites More sharing options...