I know that this is a simple one but never the less I forget how to do it.
How do I create white spaces on my screen.

Im writting in DEV-C++. I want my output to look something like this

Name title pay
Sam Uni student shit

I know how to output everything on the page but just don't know how to space them out. I know that I could do it by doing a cout statment followed by inverted comma and a shit load of spaces (or as required) inverted comma, semicolon. But that will look messy.

Im just chasing the simple code on how to create those spaces, my friend taught me and my text book sucks and it doesn't teach me.


If you are using cout then you can use setw()

#include <iostream>
#include <iomanip>
using namespace std;

int main(int argc, char* argv[])
    cout << setw(10) << "Hello";
    return 0;

Sweet, that was exactly what I was looking for. Thanks mate.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.