| | |
Help with C++ project
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Apr 2007
Posts: 3
Reputation:
Solved Threads: 0
Help with C++ project
59 Minutes Ago | Add to it_dude's Reputation vbrep_register("343564") | Flag Bad Post | #1
I am a beginning programmer and urgently need help with a project that requires me making a game consisting of a "gameboard". It looks something like this:
1 2 3
1 2 3
1 2 3
1 2 3
1 2 3
The goal is to find a way to cause the numbers to disappear.
For example if I choose column 1, and an amount of 3, the board look like this:
2 3
2 3
2 3
1 2 3
1 2 3
There are 2 players in the game and the game finishes when the last player is left with a number.
I want to know how to make the numbers disappear.
PLEASE HELP!
59 Minutes Ago | Add to it_dude's Reputation vbrep_register("343564") | Flag Bad Post | #1
I am a beginning programmer and urgently need help with a project that requires me making a game consisting of a "gameboard". It looks something like this:
1 2 3
1 2 3
1 2 3
1 2 3
1 2 3
The goal is to find a way to cause the numbers to disappear.
For example if I choose column 1, and an amount of 3, the board look like this:
2 3
2 3
2 3
1 2 3
1 2 3
There are 2 players in the game and the game finishes when the last player is left with a number.
I want to know how to make the numbers disappear.
PLEASE HELP!
Usually if the board is not too big reprinting the whole thing (with spaces where you want a number the disappear) does the trick fast enough..
clear the screen before you print of course..
E.g.
will give an illusion that 1 disappears after 1 second..
clear the screen before you print of course..
E.g.
c Syntax (Toggle Plain Text)
System("clrscr"); printf( "1 2 3" ) ; Sleep(1000) ; System("clrscr"); printf( " 2 3" ) ;
will give an illusion that 1 disappears after 1 second..
Last edited by thekashyap; Apr 12th, 2007 at 10:59 am.
•
•
•
•
Usually if the board is not too big reprinting the whole thing (with spaces where you want a number the disappear) does the trick fast enough..
clear the screen before you print of course..
E.g.
c Syntax (Toggle Plain Text)
System("clrscr"); printf( "1 2 3" ) ; Sleep(1000) ; System("clrscr"); printf( " 2 3" ) ;
will give an illusion that 1 disappears after 1 second..
System() is undefined and Sleep() may not be defined (depends on your compiler).it_dude, you need to describe what you want better than that. From your description there are hundreds of ways to do what you want, but few will be useful to you (as you can see from thekashyap's response
)Try posting code so we know what you are dealing with. Be sure to read up on Code Tags first.
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
•
•
Join Date: Apr 2007
Posts: 3
Reputation:
Solved Threads: 0
My questin is how do i make numbers disappear from the gameboard using for statements and preferably no arrays. i was able to make it build a gameboard but don't know what next step in making it disappear
Here is my code:
Here is my code:
c Syntax (Toggle Plain Text)
//Final Project-Game BY Dennis Rodriguez, Created/Revised April 12, 2007 #include <iostream> #include <iomanip> #include <string> using namespace std; //validation of column function prototype int validcol(int, int, string); int main() { //declare variables string name1 = ""; string name2 = ""; int col = 0; int num = 0; //Get players names cout <<"Enter player 1's name: "; cin >> name1; cout <<"Enter player 2's name: "; cin >> name2; //clear the screen system("cls"); //display gameboard for (int die1 = 1; die1 <= 5; die1 = die1 + 1) { for (int die2 = 1; die2 <= 3; die2 = die2 + 1) { cout << die2 << " "; } cout << endl; } //call validcol function validcol(col,num,name1); /*cout << "Enter number to take: "; cin >> num;*/ while (num > 5 || num < 1){ cout << num << " isn't a valid number for column " << col << ". Enter a valid number to take: "; cin >> num; } system("pause"); } //validation of column function definition int validcol(int column,int num, string name1) { cout << name1 << ", enter column to take from: "; cin >> column; if (column == 1 || column == 2 || column == 3) { cout << "Enter number to take: "; cin >> num; /*cout << column << " isn't a valid column. Enter a valid column to take from: "; cin >> column;*/ } else { cout << column << " isn't a valid column. Enter a valid column to take from: "; cin >> column; } return num; }
Last edited by WaltP; Apr 13th, 2007 at 12:49 am. Reason: Added CODE tags, since you ignored the request to use them
Did the link confuse you? Or did you simply ignore my suggestion?
:evil:
:evil:
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
•
•
•
•
Except for the fact thatSystem()is undefined andSleep()may not be defined (depends on your compiler).

c Syntax (Toggle Plain Text)
//something that will clear the screen e.g. system("cls"); printf( "1 2 3" ) ; //something that will make this thread sleep for a minute e.g. Sleep(1000) ; //something that will clear the screen e.g. system("cls"); printf( " 2 3" ) ;
this will give an illusion that 1 disappears after 1 second..
Last edited by thekashyap; Apr 13th, 2007 at 3:55 am.
![]() |
Similar Threads
- Integrate Microsoft Project 2003 in Microsoft SharePoint 2003 Server (Windows NT / 2000 / XP)
- Project on offer - GUI for ATi Drivers (Software Development Job Offers)
- Wade Robson Project (Geeks' Lounge)
- ASP .NET web apps/service in VS.NET won't let me name the project? (ASP.NET)
- amateur coders needed , project in audio streaming (C++)
- Group Project Ideas (Geeks' Lounge)
Other Threads in the C++ Forum
- Previous Thread: Finding matchin characers in strings
- Next Thread: iomanip, setprecision - inprecise?
Views: 1051 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll encryption error file forms fstream function functions game getline givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linux loop looping loops map math matrix memory microsoft newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






