Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scrolling Output That Exceeds Screen Size
#18
Since I was just writing about C (Aurel), here's the whole stuff also in C++.

Code: (Select All)

//Die formatierte Ausgabe auch noch in C++ - 19. April 2024
//-iomanip- Für setw() und cin.width(int)

#include <iostream>
#include <iomanip> 
#include <string>

using namespace std;

int main(void)
{
int eingabe;

system("cls");
cout << "\nThis program will count to 100 from the number you supply.";
cout << "\nEnter the number to start counting from > ";
cin >> eingabe;
cout << "\n";

for(int i = eingabe; i <= 100; i++)
{
//Festpunktzahl - Nachkommastellen - Feldbreite
cout << fixed << setprecision(0) << setw(4) << i;
if((i % 20) == 0)
cout << "\n";
}
//Neue Zeile
cout << endl;
return(0);
}

Compile with:
PS D:\Lab\C++> g++ -o ausgabe-formatiert ausgabe-formatiert.cpp
Reply


Messages In This Thread
RE: Scrolling Output That Exceeds Screen Size - by Kernelpanic - 04-19-2024, 07:22 PM



Users browsing this thread: 1 Guest(s)