i need a program that can scanf a word and printf it again but it should only be possible to write letters in the scanf
if you write numbers or so it should printf a error or something
i need a program that can scanf a word and printf it again but it should only be possible to write letters in the scanf
if you write numbers or so it should printf a error or something
So write one! If you have questions about code you have already written, post back here (be sure to enclose your code in "code" tags!).
Free code: http://sol-biotech.com/code/.
It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
--Me, I just made it up
The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
--George Bernard Shaw
did you read the title ?Originally Posted by mitakeet
Your compiler come with helpfiles?
Did google puke on "use of scanf"?
Dont expect code to be given, your question looks to me like a very thinly veiled "I cant do my own homework so someone do it for me" type question. Post your code we will willingly help fix it up. Come begging and nobody will take any notice.
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
fair...
now i only need a way to remove everything but a-z and A-ZCode:#include<stdio.h> int main(void) { char c[255]; puts("skriv noget her ffs\n"); gets(c); puts(c); return 0; }
For starters consult our FAQ for reasons not to use gets() and follow the advice there to fix that problem. For the elimination of all but alphabetical characters you can use the functions in ctype.h such as isalpha() and isspace() etc. look them up in your helpfiles and have a go for yourself. Post your efforts and we'll help further should it be needed.
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
I would also take a look at sscanf(). This is usually the recommended way by the C guys.
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi