Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Some-stuff
//g++ 7.4.0 //-------------------------------------------------------// // Author: Bason40 // // Date : 2020-10-14 // // // // Declare variables, output some text, input an integer // // Confirm input, make an string array of that size // // Let the array "tal" have size + 1 elements // // Make an iteration where the array fills with numbers // // from 1 to (y+1) // // Make a nice output with 10 numbers a row // //-------------------------------------------------------// #include <iostream> int main() { //std::string s = std::to_string(5); int x; int rad; int y; std::cout << "Exempel på inmatning. \n\n"; std::cout << "Mata in ett tal: "; // Type a number and press enter std::cin >> y; // Get user input from the keyboard std::cout << "Ok, du skrev: " << y; //------------------------------------------------------------------------ std::string tal[y+1]; // Gör en array med y element (0 till y-1) x=1; std::cout << "\n Tilldelning till array borjar \n"; ++y; while (x < y) { tal [x] = std::to_string(x); x++; } x= rad= 1; while (x < y) { std::cout << " "; // Left margin while(rad < 11 and x < y) // Output 10 numbers in one row { std::cout << tal [y-x] <<" "; //In reverser order x++; //Increment x rad++; //Count the numbers of the row } std::cout <<"\n"; // Put a linebreak rad=1; // Start a new line } // OBS the numbers have to be > 9 return 0; }
run
|
edit
|
history
|
help
0
Listas enlazadas - merge
Parenthesis checker
Boost phoenix. e.g 2: functor
ShoppingList
Atul
c++ mouse
Tubee c++
NonparaSign
Sekhejane link
Round prices