Tabelle
-
Hallo ich versuche gerade folgendes:
Wenn man z.b. eine 1 eingibt dann soll an Position 1 ein X erscheinen
0
1 <-- Da soll dann das X hin
2
3Wie könnte man sowas machen mir fällt da nichts ein

#include <iostream.h> using namespace std; void tabelle(); int main() { tabelle(); return 0; } void tabelle() { for (int i=0 ; i<4;i++) { cout<<i<<endl; } }
-
Naja wichtig wäre auf jedenfall erstmal, das du dir eine ordentliche Formatierung angewöhnst.Dann müsstest du eine Eingabe über
std::cingestalten.
Dann füllst du ein Array und suchst darin die Zahl die eingegeben wurde und fügst ein X ein.Wichtig ist vielleicht das du einstd::string-Array nimmst, oder sogar einstd::vector<std::string>
-
#include <iostream.h> using namespace std; void tabelle(int x); int main() { int i; cin >> i; tabelle(i); return 0; } void tabelle(int x) { for (int i=0 ; i<4;i++) { if(i==x) cout<<'X'<<endl; else cout<<i<<endl; } }