This is a very old thread! I haven't played with C++ for quite awhile but I imagine instead of going from 1 attempts to 3, maybe reverse that and start at 3 and use that counter as a text prompt....
Type: Posts; User: samwillc
This is a very old thread! I haven't played with C++ for quite awhile but I imagine instead of going from 1 attempts to 3, maybe reverse that and start at 3 and use that counter as a text prompt....
Can try this thread: http://cboard.cprogramming.com/cplusplus-programming/155785-implement-source-code-turns-numbers-into-english-text.html
Maybe this will give you some pointers.
Yes, 'or' on those three conditions would have always have been true whatever a user entered so the loop would always run. All three needed to be 'and'. I'm glad you got it sorted :)
Hi tsdad.
I don't believe you actually need an if statement in this situation, or a break. The loop itself handles the conditions because it will only exit once a correct option has been...
I use my calculator all the time! :p
Aha, that makes more sense, thanks for the explanation :)
Something like this?
srand = 16,867,565,532,618,582,454,987,265
So on first run:
srand = 16,867,565,532,618,582,454,987,265
54,987 being returned as the random number from rand(). And on...
Hi everyone,
From jumping into C++, there is this code:
#include <ctime>
#include <cstdlib>
#include <iostream>
If you use an integer, if your friend types in 3.57 for the radius, it will be saved as 3, which will give you an inaccurate result.
I used PI as 3.142 as an approximation as grumpy said. Press...
The volume is:
3.142 x (radius x radius) x height
[code]
What about a couple of floats for the radius and height values.
[code]
Thanks for all the input. I have been busy the past few days and not had a chance to look at arrays. I will carry on over this weekend, then eventually get back to that tic tac toe game!
Ah, I think I see.
BoardPos.at(5) = BoardPos_t::X;
would be written instead of:
Sorry, I edited before you posted again.
enum TicTacToeSquare {circle, cross, blank}
Then what is the value of cross, circle, blank here?
*EDIT*
I will look at the link :) and try to work this out.
1) If a user inputs a 4
2) int boardPos4 is updated to a circle (which is enum value 2);
3) If I now std::cout boardPos4 to show a circle...
Yes, this is how I would expect it too, so I need to find a way to show 0,1 or 2 as a 'X', 'O' or blank. I will look at your post in more detail later and practice more with arrays. I haven't...
I will go away and research into this. I think otherwise this thread will go on forever.
I am aware that a game can be finished before all the squares are filled up but I had no idea what a 'cats...
I'm still working on arrays but let's just say I have a bunch of integers for now. This is how I imagine it working if this helps to clarify my position:
Board is blank, this is shown on screen:
...
You're right, in a real life scenario, but if I was playing this game online gor example, I would expect the squares to be numbered to show which one to choose. Rather that than choose a row 1-3,...
In reality, if I physically have a board in front of me, the squares are blank. I couldn't put a cross where there is already a cross. I couldn't put a circle where there is already a circle. I can...
Ok, so I'm getting there after getting sidetracked with enums. I only have a few problems left now.
#include <iostream>
char gameBoard [3][3] = {{'1', '2', '3'}, {'4', '5', '6'}, {'7', '8',...
Thanks to all who have helped so far. So I have put this together with the snippets outlined along the way.
#include <iostream>
#include <string>
enum CarType {CT_FORD, CT_MUSTANG,...
I think this is happening right now.
I thought that may be the case after watching the video again, a normal return value (as I have used) would also 'put back in main' or however he puts it....
If I recorded myself saying this, added noise and then played it back to myself in reverse, it would make as much sense as this does to me at my stage of learning. I will come back to this in a years...
Thanks everyone. I will try the examples later after work.
I'm trying hard to understand this (so I can use it in my tic tac toe game)! I will try to explain my problem a bit further. The thing I don't get is this:
#include <iostream>
int main()...