I used Visual Studio's debug feature to walk through the code line by line.
when I input
"updatemark 123456789 10 f9"
after cin >> a; it will strcmp to updatemark and then cin >> b >> idx >> mark;
then it will jump back to cin >> a; and produce "the arguement is not a number" because the value of a was alter to a unknown digit.
I...
User Profile
Collapse
-
Order of error detection
When I put my code through different inputs, one form of input results in a problem. when I enter:
updatename 123456789 10 f9
the expected output is
"Error: 10 is out of the range 0-4"
whereas I got
"Error: argument is not a number"
i tried moving the error detection around and it wouldn't work. Seem like a simple problem but I can find... -
I kind of understand what you mean by this, but I have trouble converting this idea into code. Can you show me a simple representation of this in code?Leave a comment:
-
-
I actually know how to use classes and structs but this project doesn't allow classes:(Leave a comment:
-
haven't learn struct neither :(
can you do this with an array?Leave a comment:
-
I am not able to use classes though:S is the an easier way to implement this??Leave a comment:
-
well for example. in a 8x8 array i have pieces such as
king (3,4)
queen(1,2)
rook(2,3)
x(4,4)
from the code i have above, I am able to input these pieces into the array. But now I have to see if those piece will be able to move to (4,4) which is X's position based on each piece's limitations.Leave a comment:
-
searching an array
I have to write a program that simulates chess such that a chess piece X is located in a 2D array and other pieces are tested if they are capable of moving to X's position.
...Code:int board[8][8]; char command[200], code, charwidth[2], charheight[2]; scanf("%s", command); char *ptr = command; for(int a = 0; a < 8; a++) {
No activity results to display
Show More
Leave a comment: