Win a copy of Microservices in Action this week in the Web Services forum!

David Simic

+ Follow
since Dec 06, 2018
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by David Simic

John Matthews wrote:

David Simic wrote:I want to add "fi gg kk rr" into array using switch

So what are the single characters for? And the switch is only executed once - it can't set multiple array elements; should it be inside a loop? And the switch just does printf(), it doesn't assign any values to the array.

I feel like you don't understand what a switch does, which is why I wrote the if/else if version. Do you see why switch(test[3][3]) might cause a crash?

Yeah, my mistake about that test[3][3], i was trying some combination to see what would happen.

And yes, it should be used inside the loop.
3 days ago

John Matthews wrote:explain what -> explain how

well the simple explanation is:

I want to add "fi gg kk rr" into array using switch
and i and the output of that array to be like
fi  gg
kk rr

i know it can be done using if else, but i need it to be done with switch.
4 days ago

John Matthews wrote:Hi David

David Simic wrote:

You define the array as being 3x3, but only initialize 2x3.

A valid array index is in the range 0..2; test[3][3] is outside the array you have defined. What is it you are attempting to switch on?

I tryed 2x2 now and still crash

Im trying to have my code printout
fi  gg
kk rr

When i put %c instead of %s it prints out

I want it to print out what i said in the printf(), all 4 cases

4 days ago
need help on adding elements to array using switch, i tried this, but program crashes every time i compile

Can't find what i did wrong, any help ?
I want output to be like
fi gg kk
rr nn ff
4 days ago
Could it be made using Switch ?

For example to add letter K in the array and then use

case 'K'

and then write pattern

1 week ago

Campbell Ritchie wrote:

Tim Holloway wrote:. . . double the number of templates (12 instead of 6). . . .

More likely twenty‑four. You go from queen to black queen on black square, black queen on white square, white queen on white square and white queen on black square.

I have created all patterns,
example of one chess figure looks like this

How can i add this pattern into array ??
1 week ago
Should i make those patterns using Printf or using for loops ?
1 week ago

Tim Holloway wrote:C and C++ are not that much different, and both are so close to the hardware that it's mostly a matter of brute force.

I believe that there's a compiler switch to force the primitive type "char" to be either traditional (8 bits) or wide (16 bits). You need 16-bit characters to hold the extended Unicode characters. Or you could just plow through with UTF-8, but since all the characters in the chess subset of Unicode are 16 bits anyway, why bother?

Of course, none of this does any good at all unless the output system is set up to display Unicode. So make sure you are outputting to a terminal device (or whatever) that can handle it. And that has been instructed to handle it.

I found out that i can't use UNICODE to draw chess table and symbols.
In order to draw this chess table and symbols :

Rules are:
1. To define black color field i can use ASCII code 177 and for white field i can use 178
2.To define black figures i can use ASCII 170 and for white 219

So, how can i draw this ??
1 week ago

Campbell Ritchie wrote:Don't know how to draw those little squares, sorry, but I didn't think they looked any good.

Just  those little squares on Bishops ?
Can you write King or Knight, or any other symbol(just one ) ?

1 week ago

Campbell Ritchie wrote:

Shell Meister wrote:. . . is it possible to make something in C that looks like this . . .

Yes, but would you want to? I have found out that you can print Unicode in C++. Haven't found anything for C.

Yes, i want it to be made in C just the way it looks like in the picture(only chess symbols), but i don't know how.
That's why i'm asking for help
1 week ago

John Matthews wrote:How about something a bit more low tech: here

Thank you for reply,
but is it possible to make something in C that looks like this :
1 week ago

Campbell Ritchie wrote:Welcome to the Ranch

Can you display Unicode symbols? Look here.

I don't know how to display Unicode symbols, i tried something but it outputs nothing or it does not output the symbol i want.
Can you write a code for one Chess Symbol, just so i can see how it looks like.
I tried googling "how to print Unicode in C" but it mostly shows C++ and the ones i found in C are not working.

BTW, i am using Code Blocks to write C code and compile it.
1 week ago

I nee help on how to create CHESS Symbols in C programming that looks like this in the picture

Just the Chess symbols, not the whole board.

Any help is appreciated,

1 week ago