Zufallsgenerator
-
Danke für die Hilfe aber noch ist nicht alles gelößt:
So hab des Programm jetzt nen bischen umgeändert:
#include <iostream> #include <stdlib> #include <stdio> #include <time> #include <process> #include <stdlib.h> #include <process.h> using namespace std; int main() { int x; time_t t; srand((unsigned)time(&t)); x=rand()%13; cout << x; cout << "/n"; system("PAUSE"); cout << "/n"; x=rand()%25; cout << x; cout << "/n"; system("PAUSE"); return 0; }Da kommen aber jetzt wieder Fehler (Forher nicht genannt):
stdlib: No such file or directory.
stdio: No such file or directory.
time: No such file or directory.
process: No such file or directory.mfg Luke014
-
Heißt das nicht <stdlib.h>, <time.h>, <stdio.h> und <process.h>???
-
Das heißt er findet die Header nicht...Keine Ahnung wo Du das gefunden hast (also den Code) aber die Includes sind teilweise nicht nur Schwachsinn (also überflüssig), sondern auch falsch (= nicht existent). Weiterhin sieht das mehr nach C aus.
Mach es so (Habs mal ausführlicher kommentiert
):#include <ioStream> // Für die Standardfunktionen(und Klassen): cout, cin, rand, srand, ... #include <cTime> // Für die time-Funktion using namespace std; int main() { time_t ttSeed; time(&ttSeed); // <- aktuelle Zeit holen // Zufallsgenerator initialisieren: srand(static_cast<unsigned int>(ttSeed)); // 10 Zufallszahlen ausgeben: for(int i = 0; i < 10; i++) cout << rand() % 25 << endl; // Verhindern, dass sich die Konsole automatisch schließt: cin.clear(); cin.ignore(cin.rdbuf()->in_avail()); cin.get(); return (0); }
-
Coooooooooooooooooooooooooooooooooool
daran hats gelegen
DANKE EUCH ALLEN
HOFFE IHR KÖNNT MIR BALD WIEDER WEITERHELFEN
ODER VILEICHT AUCH HOFFE IHR MÜSST MIR NIE WIEDER WEITERHELFEN
-
Stromberg schrieb:
Heißt das nicht <stdlib.h>, <time.h>, <stdio.h> und <process.h>???
Oder bei den C-Standard-Headern .h weg und c davor:
csdlib, ctime, cstdio...Greetz
-
CodeFinder schrieb:
[...]
#include <ioStream> // Für die Standardfunktionen(und Klassen): cout, cin, rand, srand, ... #include <cTime> // Für die time-Funktion //...Viel Spass beim Compilieren auf einer Plattform mit case-sensitive Dateisystem

-
CodeFinder schrieb:
#include <ioStream> // Für die Standardfunktionen(und Klassen): cout, cin, rand, srand, ...Die Standardfunktionen rand und srand sind aber garnicht in <iostream>

-
LordJaxom schrieb:
CodeFinder schrieb:
#include <ioStream> // Für die Standardfunktionen(und Klassen): cout, cin, rand, srand, ...Die Standardfunktionen rand und srand sind aber garnicht in <iostream>

Weder das noch sind cout und cin irgendwelche Klassen noch Funktionen!

-
Gehören folgende Dateien zur C++ Standartbibliothek?

conio.h
graph.hmfg Luke014
-
Hallo
nein
bis bald
akari
-
ok
und wie kann man an Dateien kommen die necht in der C++ Standartbibliothek vorhanden sind?
mfg Luke014
-
gooooogle
mfg,
julian
-
nach welchen stichwörtern soll ich da googeln?
-
Hallo
Zum Beispiel conio. Da habe ich gleich auf der ersten Trefferseite das hier gehabt.
bis bald
akari