Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / c++ need help on arrays

Author
Message
Serengeor
15
Years of Service
User Offline
Joined: 17th Jan 2009
Location: Lithuania/lietuva
Posted: 19th Feb 2009 17:45
I've got a little problem.
I don't know how to check if my char array has got a space (things we usually put in between words).
well I'm actually checking every single thing in array if its space or a letter.


please see the code and try to help me
BTW i know its not about DGK but bi need to know this maybe it will help me in creation of DGK games later.

GDK Developer since now
Murloc
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location: Utena,Lithuania
Posted: 19th Feb 2009 18:13
The code won't even work at all. There are some syntax errors.

But I fixed it as you want it to be



P.S. Tu lietuvis?

Theory-When you know everything,but nothing works.
Practice-When everything works,but you don't know why.
Programming merges these two-Nothing works,and you don't know why.
Serengeor
15
Years of Service
User Offline
Joined: 17th Jan 2009
Location: Lithuania/lietuva
Posted: 19th Feb 2009 19:19 Edited at: 19th Feb 2009 19:29
aha as lietuvis
ten nebuvo jokiu syntax error tik kai nukopinau ir biski pratryniau gal ka netycia padariau kokiu nesamoniu
Aciu jeigu veiks isbandyk programele
Edit:Something is still wrong here i cant put any sentences because it only reads text until space i need it to read sentences and output something to file.
Ps. duok skype savo

GDK Developer since now
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Feb 2009 19:32
cin>> c;

... that reads in a single word.
If you want a whole line, use the getline function

Serengeor
15
Years of Service
User Offline
Joined: 17th Jan 2009
Location: Lithuania/lietuva
Posted: 19th Feb 2009 19:35
Thanx
You are the best

GDK Developer since now
Murloc
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location: Utena,Lithuania
Posted: 19th Feb 2009 19:38 Edited at: 19th Feb 2009 19:38
To Serengeor:
coolerrizz

Theory-When you know everything,but nothing works.
Practice-When everything works,but you don't know why.
Programming merges these two-Nothing works,and you don't know why.
Serengeor
15
Years of Service
User Offline
Joined: 17th Jan 2009
Location: Lithuania/lietuva
Posted: 19th Feb 2009 20:14 Edited at: 19th Feb 2009 20:17
One more problem with the code.
How do check for number and things like in parenthesis (,./\?:;'"()[]!@#$%$^&*+-) in char array ?

GDK Developer since now
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Feb 2009 20:41
Just like you have already been checking, except for the single quote and the backslash - to do those you'll need to do this:


Serengeor
15
Years of Service
User Offline
Joined: 17th Jan 2009
Location: Lithuania/lietuva
Posted: 20th Feb 2009 07:18
Mhm what about numbers. They dont work.
What should i use for them?

GDK Developer since now
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 20th Feb 2009 23:34 Edited at: 20th Feb 2009 23:51
Quote: "Mhm what about numbers. They dont work.
What should i use for them?"


In what way don't they work? Digits is digits.

And I thought I'd posted this but I guess not. I'd suggest looking at using a switch/case statement. It would clean up the code a bit.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office

Login to post a reply

Server time is: 2024-09-30 19:30:59
Your offset time is: 2024-09-30 19:30:59