Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I'm learning C++, It has been two months now.

After learning many aspect of the language, I want to practice to make simple program without Graphic UI.

I want to make simple games like MadLibs or MasterMind.

How do I go about doing that without scrolling.
I've read somewhere that they used to do it using arrays, but when I try, that didn't eliminate the scrolling.

How to do it?

[update]
found it.
C++
#include<windows.h>
main()
{
    some code....;
    system("cls");
    some more code;
}


=================

[update]
What I was trying kinda look like this, found this madlib on the internet.

C++
#include<iostream>
#include <string>
using namespace std;

int main()
{

	cout << "Welcome\n" << "Enter your name" << endl;
	string userName;
	getline(cin, userName);
	system("cls");

	cout << "Hi, " << userName << endl;
	cout << "Enter an adjective: ";
	string adjective1;
	getline(cin, adjective1);

	cout << "Enter a noun: ";
	string noun1;
	getline(cin, noun1);

	cout << "Spell a number: ";
	string number;
	getline(cin,number);

	cout << "Enter a noun: ";
	string noun2;
	getline(cin, noun2);

	cout << "Enter an adjective: ";
	string adjective2;
	getline(cin, adjective2);

	cout << "Enter an verb: ";
	string verb;
	getline(cin, verb);

	cout << "Enter a noun: ";
	string noun3;
	getline(cin, noun3);

	cout << "Enter a body part: ";
	string bodyPart;
	getline(cin, bodyPart);

	cout << "Enter an adjective: ";
	string adjective3;
	getline(cin, adjective3);
	system("cls");

	cout << "Look, I guarantee there`ll be " << adjective1
		<< " times. I guarantee that at some " << noun1
		<< ", \n" << number << " or both of us is gonna want to get out of this "
		<< noun2 << ". \nBut I also guarantee that if I don`t ask you to be "
		<< adjective2 << ", \nI`ll " << verb << " it for the rest of my "
		<< noun3 << ", because I know, \nin my " << bodyPart << ", you`re the "
		<< adjective3 << " one for me." << endl << endl;

	cout << "Thank you!" << endl;
	getchar();
	return 0;
}


-->In future I'm planning to learn how to make simple menu/frame based from this (kinda like the 'Edit' software in command prompt from old Windows).

-->I also plans to let the user to 'random' the language parts which will generate a word from small dictionary file.
Posted
Updated 5-Oct-15 19:32pm
v3
Comments
Mohibur Rashid 5-Oct-15 23:27pm    
What have you tried?
Are Riff 6-Oct-15 1:33am    
I've updated my question.
Sergey Alexandrovich Kryukov 6-Oct-15 0:56am    
This is not "DOS program". This is Windows. What you are trying to do makes little sense.
—SA
Are Riff 6-Oct-15 1:33am    
I've updated my question. Sorry for wrong choice of word.
Sergey Alexandrovich Kryukov 6-Oct-15 2:52am    
I already answered the question.
—SA

You might want to check out text user interface libraries such as curses[^]. They allow much more control than system("cls").

P.S.: Even though mainly used in UNIX like systems, there are Windows implementations. We still have a curses-based app here that runs on modern Windows systems.
 
Share this answer
 
v2
For information: DOS permit GUI.
What you are doing is a console application, or said otherwise char mode application.
By using a library like in Solution 2, you will be able to control the position of cursor and color of what goes on screen.

What you have been doing until now is called Teletype application because Linefeed is your only control on how thing are on screen.
 
Share this answer
 
Please see: http://stackoverflow.com/questions/1670891/how-can-i-print-a-string-to-the-console-at-specific-coordinates-in-c[^].

There is no such thing as "DOS program" on Windows. It's not just wrong words; it makes it apparent that your basic knowledge on the OS you use is badly outdated.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900