Stránka: 1 z 7
| [ Príspevkov: 198 ] | 1, 2, 3, 4, 5 ... 7 |
| Autor | Správa |
|---|
Registrovaný: 08.03.09 Prihlásený: 17.01.25 Príspevky: 1116 Témy: 88 | 88 Bydlisko: 00100100 |
Neviete ako sa da stopnut program v C++ ale inak ako system("pause")???
_________________ Programming is The Best
Hackers Are Not Crackers!!! Hackers build things, crackers break them!
;-) |
|
Registrovaný: 30.04.08 Prihlásený: 03.12.25 Príspevky: 884 Témy: 3 | 3 |
Skus napr.
Kód: while (getchar()!='\n') ; getchar();
_________________ Empty your memory, with a free()… like a pointer! If you cast a pointer to an integer, it becomes the integer, if you cast a pointer to a struct, it becomes the struct… The pointer can crash…, and can overflow… Be a pointer my friend… |
|
Registrovaný: 08.03.09 Prihlásený: 17.01.25 Príspevky: 1116 Témy: 88 | 88 Bydlisko: 00100100 |
ale ved to je C ale ja potrebujem pre C++ ne?takze ine nejake
_________________ Programming is The Best
Hackers Are Not Crackers!!! Hackers build things, crackers break them!
;-) |
|
Registrovaný: 30.04.08 Prihlásený: 03.12.25 Príspevky: 884 Témy: 3 | 3 |
To je jedno, mozes to pouzit aj v C++
_________________ Empty your memory, with a free()… like a pointer! If you cast a pointer to an integer, it becomes the integer, if you cast a pointer to a struct, it becomes the struct… The pointer can crash…, and can overflow… Be a pointer my friend… |
|
Registrovaný: 08.03.09 Prihlásený: 17.01.25 Príspevky: 1116 Témy: 88 | 88 Bydlisko: 00100100 |
to hej ale v knihe je to nedoporucovane pretoze su to funkcie C ci co a niesu take chytre ako C++
_________________ Programming is The Best
Hackers Are Not Crackers!!! Hackers build things, crackers break them!
;-) |
|
Registrovaný: 11.01.09 Prihlásený: 25.04.26 Príspevky: 1399 Témy: 10 | 10 Bydlisko: Hrinova |
1.) jazyk C++ je vyvinutý z jazyka C
2.) neznášam, keď sa niekto odvoláva na : "v knihe je napísané .... "
Proste ak ti neutronmind - skúsenejší užívateľ - napíše, že to tak ide, tak ho počúvni.
Jednoducho na konci tvojho programu pred poslednú zátvorku } daj príkaz getchar() a výsledok bude presne taký, ako chceš. To, že to nie je v knižke neznamená, že to nie je správne alebo funkčné.
|
|
Registrovaný: 08.03.09 Prihlásený: 17.01.25 Príspevky: 1116 Témy: 88 | 88 Bydlisko: 00100100 |
jj viem len to v knihe nevravia pretoze to je kniha O C++ a nie o C ale poznam to nebojte sa vraj podla autora su funkcie C++ lepsie a rozumnejsie ale daju sa pouzivat aj funkcie z C a aj kniznice z C dakujem
_________________ Programming is The Best
Hackers Are Not Crackers!!! Hackers build things, crackers break them!
;-) |
|
Registrovaný: 30.04.08 Prihlásený: 03.12.25 Príspevky: 884 Témy: 3 | 3 |
kenny8911 píše: neutronmind - skúsenejší užívateľ
reDo: Myslim, ze casom sa naucis, ktoru funkciu je kedy lepsie pouzit - napr. casto sa pouzivaju C-ckovske funkcie printf a scanf, kedze cin a cout su pomalsie, vzdy vsak zalezi od konkretneho problemu. 
_________________ Empty your memory, with a free()… like a pointer! If you cast a pointer to an integer, it becomes the integer, if you cast a pointer to a struct, it becomes the struct… The pointer can crash…, and can overflow… Be a pointer my friend… |
|
Registrovaný: 08.03.09 Prihlásený: 17.01.25 Príspevky: 1116 Témy: 88 | 88 Bydlisko: 00100100 |
dobre skusim to
_________________ Programming is The Best
Hackers Are Not Crackers!!! Hackers build things, crackers break them!
;-) |
|
Registrovaný: 02.11.07 Prihlásený: 18.03.15 Príspevky: 470 Témy: 22 | 22 Bydlisko: Zilinska Un... |
reDo, uc sa, ale zatial nerad nikomu  ..... ty v podstate mozes hociake kniznice pouzit hocikde po neakych upravach  a ja tes v C++ vyuzivam funkcie z C ako printf a fun. pre necitanie zo suboru, hlavne v OpenGL, kde su vysoke poziadavky na rychlost  a naviac getchar v c++ je rozsireny o par dobrych veci na co samotny cin a cout nestacia 
_________________ Notebook: HP EliteBook 8740w
You can see my work in my www |
|
Registrovaný: 08.03.09 Prihlásený: 17.01.25 Príspevky: 1116 Témy: 88 | 88 Bydlisko: 00100100 |
ty si dobty ked ves OpenGL vraj to pozna len elita
_________________ Programming is The Best
Hackers Are Not Crackers!!! Hackers build things, crackers break them!
;-) |
|
Registrovaný: 30.04.08 Prihlásený: 03.12.25 Príspevky: 884 Témy: 3 | 3 |
To platilo pred "par" rokmi. 
_________________ Empty your memory, with a free()… like a pointer! If you cast a pointer to an integer, it becomes the integer, if you cast a pointer to a struct, it becomes the struct… The pointer can crash…, and can overflow… Be a pointer my friend… |
|
Registrovaný: 08.03.09 Prihlásený: 17.01.25 Príspevky: 1116 Témy: 88 | 88 Bydlisko: 00100100 |
aha mam stare informacie ale oplati sa to ucit ze??
_________________ Programming is The Best
Hackers Are Not Crackers!!! Hackers build things, crackers break them!
;-) |
|
Registrovaný: 30.04.08 Prihlásený: 03.12.25 Príspevky: 884 Témy: 3 | 3 |
Samozrejme, pokial sa tomu chces venovat... 
_________________ Empty your memory, with a free()… like a pointer! If you cast a pointer to an integer, it becomes the integer, if you cast a pointer to a struct, it becomes the struct… The pointer can crash…, and can overflow… Be a pointer my friend… |
|
Registrovaný: 08.03.09 Prihlásený: 17.01.25 Príspevky: 1116 Témy: 88 | 88 Bydlisko: 00100100 |
tam ide o grafiku a je tam aj nejaky specificky jazyk ??ako napr C++ alebo neco take alebo to je vsestranne
_________________ Programming is The Best
Hackers Are Not Crackers!!! Hackers build things, crackers break them!
;-) |
|
Registrovaný: 30.04.08 Prihlásený: 03.12.25 Príspevky: 884 Témy: 3 | 3 |
Povodne to bolo urcene pre C, avsak mozes to pouzit aj v Cpp alebo Jave...
_________________ Empty your memory, with a free()… like a pointer! If you cast a pointer to an integer, it becomes the integer, if you cast a pointer to a struct, it becomes the struct… The pointer can crash…, and can overflow… Be a pointer my friend… |
|
Registrovaný: 08.03.09 Prihlásený: 17.01.25 Príspevky: 1116 Témy: 88 | 88 Bydlisko: 00100100 |
dakujem:-)
_________________ Programming is The Best
Hackers Are Not Crackers!!! Hackers build things, crackers break them!
;-) |
|
Registrovaný: 11.01.09 Prihlásený: 25.04.26 Príspevky: 1399 Témy: 10 | 10 Bydlisko: Hrinova |
Môžeš to použiť, v čom len chceš, pretože celý kód OpenGL je v knižniciach. Aj v Delphi, aj v assembleri a určite aj vo VB. Nie je to nijako obmedzované.
|
|
Registrovaný: 08.03.09 Prihlásený: 17.01.25 Príspevky: 1116 Témy: 88 | 88 Bydlisko: 00100100 |
aha to som nevedel dikes
_________________ Programming is The Best
Hackers Are Not Crackers!!! Hackers build things, crackers break them!
;-) |
|
Registrovaný: 02.11.07 Prihlásený: 18.03.15 Príspevky: 470 Témy: 22 | 22 Bydlisko: Zilinska Un... |
samozrejme ze to mozes pouzit kde chces, ty mozes po upravach pouzit hocijake externe kniznice v takmer hociakom jazyku  , ale pre OpenGL urcite pouzi C++ , lebo v C++ si vsetko robis sam a nie si tak obmedzeny implementaciou, sice je to pre skalnych , ale treba sa ucit, ak ces spracovat grafiku v realnom case tak urcute C++ , ja sa tet idem pustit do PhysX od envidie , je to pecka a setky kniznice su robene v C++.
_________________ Notebook: HP EliteBook 8740w
You can see my work in my www |
|
Registrovaný: 08.03.09 Prihlásený: 17.01.25 Príspevky: 1116 Témy: 88 | 88 Bydlisko: 00100100 |
hej to je pouzite v Mirros' Edge brat to hrava vypada to dobre mas pravdu
_________________ Programming is The Best
Hackers Are Not Crackers!!! Hackers build things, crackers break them!
;-) |
|
Registrovaný: 08.03.09 Prihlásený: 17.01.25 Príspevky: 1116 Témy: 88 | 88 Bydlisko: 00100100 |
poznate nejake IDE pre C/C++ okrem Dev C++,Microsoft Visual Studio 2008 , Borland C++ Builder??
_________________ Programming is The Best
Hackers Are Not Crackers!!! Hackers build things, crackers break them!
;-) |
|
Registrovaný: 08.03.09 Prihlásený: 17.01.25 Príspevky: 1116 Témy: 88 | 88 Bydlisko: 00100100 |
ked mam strukturu napr
Kód: struct OSOBA { int roky=0; char meno[101]; };
preco mi nejde nastavit hned pri pisani to roky? 
_________________ Programming is The Best
Hackers Are Not Crackers!!! Hackers build things, crackers break them!
;-) |
|
Registrovaný: 30.04.08 Prihlásený: 03.12.25 Príspevky: 884 Témy: 3 | 3 |
Pretoze takto definujes len tzv. sablonu struktury, nie samotnu strukturu (resp. premennu typu struktura). Nieco taketo by ti vsak imho malo fungovat
Kód: struct OSOBA { int roky; char meno[101]; } osobka = {0, '\0');
_________________ Empty your memory, with a free()… like a pointer! If you cast a pointer to an integer, it becomes the integer, if you cast a pointer to a struct, it becomes the struct… The pointer can crash…, and can overflow… Be a pointer my friend… |
|
Registrovaný: 08.03.09 Prihlásený: 17.01.25 Príspevky: 1116 Témy: 88 | 88 Bydlisko: 00100100 |
takto hej len som sa pytalna ten moj pripad 
_________________ Programming is The Best
Hackers Are Not Crackers!!! Hackers build things, crackers break them!
;-) |
|
Registrovaný: 30.04.08 Prihlásený: 03.12.25 Príspevky: 884 Témy: 3 | 3 |
Tak, ako si to chcel ty, ti to imho nepojde...
_________________ Empty your memory, with a free()… like a pointer! If you cast a pointer to an integer, it becomes the integer, if you cast a pointer to a struct, it becomes the struct… The pointer can crash…, and can overflow… Be a pointer my friend… |
|
Registrovaný: 08.03.09 Prihlásený: 17.01.25 Príspevky: 1116 Témy: 88 | 88 Bydlisko: 00100100 |
Mam tento zdojak vlastny samozrejme poriadne primitivne ale s C++ som eln na zaciatku mam tento zdrojak nejaka chyba ohladne vypysania vysledkov aspon tie riadky mi ukazuje
dam ten zdrojak
Kód: #include <iostream>
int main() { using namespace std; float kurz=30.126; float eura; float slovak; char rozhodnutie; cout<<"Ako chcete pocitat: na eura(e) na slovenske (s)\n"; cin>>rozhodnutie; if(rozhodnutie=='e') { cout<<"Kolko je slovenskych?\n"; cin>>slovak; cout<<slovak<<"je"<<eura=slovak/kurz<<endl; } else { cout<<"Kolko je eur?\n"; cin>>eura; cout<<eura<<"je"<<slovak=eura*kurz<<endl; } cout<<"Chcete opakovat? y=ano n=nie\n"; cin>>rozhodnutie; if(rozhodnutie=='y') main(); else system("pause"); return 0; }
 pomozte pls
_________________ Programming is The Best
Hackers Are Not Crackers!!! Hackers build things, crackers break them!
;-) |
|
Registrovaný: 30.05.07 Prihlásený: 29.03.14 Príspevky: 641 Témy: 46 | 46 |
hmm takto pisu iba geniovia a idioti (myslim ten text na zaciatku)
takze vobec neviem co sa pytas, ale myslim ze using namespace sa nepise do funkcii - aspon v mojej kratkej c++ kariere som to nikdy vo funkcii nevidel.
|
|
Registrovaný: 08.03.09 Prihlásený: 17.01.25 Príspevky: 1116 Témy: 88 | 88 Bydlisko: 00100100 |
ja mam knihu a tam to je
_________________ Programming is The Best
Hackers Are Not Crackers!!! Hackers build things, crackers break them!
;-) |
|
Registrovaný: 30.04.08 Prihlásený: 03.12.25 Príspevky: 884 Témy: 3 | 3 |
Ak das direktivu using namespace std; do tela funkcie, mozes pouzivat funkcie z menneho priestoru std (bez pouzitia std::) len v tele tejto funckie; ak to das na zaciatok kodu, tak v celom zdrojaku.
Na vstup znaku pouzi clensku funkciu get() objektu cin, takisto nepouzivaj rekurziu tam, kde netreba, toboz nie vyvolavat rekurzivne funkciu main() (v C++ to vraj ani nie je povolene, Dev-C++ mi to vsak kupodivu skompiloval).
Kód: #include <iostream>
using namespace std;
int main(void) { const float kurz = 30.126; float eura, slovak; char rozhodnutie = '\0'; while (1) { cout << "Ako chcete pocitat: na eura(e) na slovenske (s)\n"; cin.get(rozhodnutie); cin.get(); if (toupper(rozhodnutie) == 'E') { cout <<"Kolko je slovenskych?\n"; cin >> slovak; cin.get(); cout << slovak << " je " << slovak/kurz <<endl; } else { cout << "Kolko je eur?\n"; cin >> eura; cin.get(); cout << eura << " je " << eura*kurz << endl; } cout << "Chcete opakovat? Y=ano N=nie\n"; cin.get(rozhodnutie); cin.get(); if (toupper(rozhodnutie) == 'N') break; } system("pause"); return 0; }
_________________ Empty your memory, with a free()… like a pointer! If you cast a pointer to an integer, it becomes the integer, if you cast a pointer to a struct, it becomes the struct… The pointer can crash…, and can overflow… Be a pointer my friend… |
|
Stránka: 1 z 7
| [ Príspevkov: 198 ] | 1, 2, 3, 4, 5 ... 7 |
|