Thread: formatting dos game

  1. #1
    Jhanoosh
    Guest

    formatting dos game

    If this post would be more appropiate in the C++ board I apologize in advance, although it is a game.
    I am just learning C++ and am trying to make a game which is text based.
    In the code i do not call for any data yet i was just trying to get the display format.
    My Problem is this when i am ready to call whatever scene description and print the paragraph to the screen the rest of my formatting gets messed up

    Code:
      #include "stdafx.h"
    #include "iostream.h"
    
    int main(int argc, char* argv[])
    {
    	
    	
    	cout.width(35);
    	cout << "Location" << endl << endl;
    	cout << " Gold: ";
    	cout.width(64);
    	cout <<"Weapon: " << endl;
    	cout <<"Armor: ";
    	cout.width(64);
    	cout <<"Spell: " << endl << endl;
    	cout.width(15);
    	
    	for (int i=0;i<50;i++)
    		{	
    			cout <<"*";
    		}
    
    	cout << endl;
    	cout.width(15);
    	cout << "*";
    	
    	cout << "   Description goes here";
    	
    	cout.width(25);
    	cout << "*";
    
    	for (int j=0;j<15;j++)
    		{
    			cout << endl;
    			cout.width(15);
    			cout << "*";
    			cout.width(49);
    			cout << "*";
    		}
    	cout << endl;
    	cout.width(15);
    
    	for (int h=0;h<50;h++)
    		{	
    			cout <<"*";
    		}
    
    	cout << endl;
    	cout << " Life:";
    	cout.width(55);
    	cout << "Mob Life:";
    	cout << endl;
    	cout << " Mana:";
    	cout << endl;
    
    	
    	
    	
    	
    	
    	return 0;
    }
    maybe i need to make a function to do some formatting but each paragraph varies in size any help at all I would be grateful
    thanx

  2. #2
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Hmm, I'm not sure what you're trying to do here. Could you clarify a bit? Are you trying to make the output wrap at certain widths? (and if possible, can you type out the characters to show us what it's supposed to look like?)
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. game engine advice?
    By stien in forum Game Programming
    Replies: 0
    Last Post: 01-23-2007, 03:46 PM
  2. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 12:48 AM
  3. Try my game
    By LuckY in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 09-15-2004, 11:58 AM
  4. My next 'dos console' game...
    By Leeman_s in forum C++ Programming
    Replies: 5
    Last Post: 11-09-2001, 06:08 AM
  5. MS DOS game with c++
    By Jeremy G in forum C++ Programming
    Replies: 7
    Last Post: 11-08-2001, 09:28 PM