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

Possibly Related Threads…
Thread Author Replies Views Last Post
  Font Size in Threads Dimster 5 377 12-12-2025, 04:49 PM
Last Post: Dimster
  auto-detecting screen resolution for optimal window size on non-Windows systems madscijr 11 1,085 11-10-2025, 07:23 PM
Last Post: madscijr
  auto-detecting screen resolution for optimal window size on non-Windows systems madscijr 0 227 10-26-2025, 06:58 PM
Last Post: madscijr
  Make IDE $Console:Only output readably large dakra137 1 541 10-10-2025, 12:21 PM
Last Post: hsiangch_ong
  Inputting output from other languages Helium5793 8 1,326 05-30-2025, 12:30 PM
Last Post: Helium5793

Forum Jump:


Users browsing this thread: 1 Guest(s)