C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

kleine buchstaben

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German)
View previous topic :: View next topic  
Author Message
jan h374hne
Guest





PostPosted: Mon Nov 24, 2003 12:00 am    Post subject: kleine buchstaben Reply with quote



hey!

das klingt jetzt nen bissel dumm, aber ich hab noch nicht wirklich so den
plan c++!
deswegen diese dumme frage!

wie kann ich überprüfen, ob ein kleines buchstage eingegeben wurde??

also:

cin >> j
while (j = grosser buchstabe)
{
cout << "error";
}
cout << j;

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
Back to top
Christian Lackas
Guest





PostPosted: Mon Nov 24, 2003 10:39 am    Post subject: Re: kleine buchstaben Reply with quote



* jan hühne [2003-11-24]:

Hallo Jan,

Quote:
wie kann ich überprüfen, ob ein kleines buchstage eingegeben wurde??

dafür gibt es einige Funktionen in cctype.

Quote:
cin >> j
while (j = grosser buchstabe)
{
cout << "error";
}
cout << j;

#include #include <cctype>
using namespace std;
int main() {
char j;
while ( cin >> j && !cin.eof() && (isupper(j) || !isalpha(j)) )
cerr << "error" << endl;
cout << j << endl;
}


Gruss
Christian
--
Wohnhaft ist ein Substantiv.
http://www.lackas.net/ Perl Delphi Linux MP3 Searchengines Domainchecker

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Peter Schütte
Guest





PostPosted: Mon Nov 24, 2003 10:56 am    Post subject: Re: kleine buchstaben Reply with quote



Quote:
wie kann ich überprüfen, ob ein kleines buchstage eingegeben wurde??

islower(), gab's schon in C.

Allerdings K&R behauptet, daß Umlaute nicht beachtet werden. Mein POSIX
Buch meint, das aktuell eingestellte locale wird beachtet.
Und ein Test unter VC++ 6.0 mit "deutschem" locale bringt für 'ä' auch
tatsächlich wahr i.S.v klein.

Gruß Peter

--
Wenn sie akzeptieren können, daß nur der langsame Fortschritt zum Erfolg
führt, werden sie keine Probleme haben.
[Arthur Lydiard]

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Rolf Magnus
Guest





PostPosted: Mon Nov 24, 2003 12:38 pm    Post subject: Re: kleine buchstaben Reply with quote

jan hühne wrote:

Quote:
hey!

das klingt jetzt nen bissel dumm, aber ich hab noch nicht wirklich so
den plan c++!
deswegen diese dumme frage!

wie kann ich überprüfen, ob ein kleines buchstage eingegeben wurde??

Reicht es nicht, selbst keine Großbuchstaben zu verwenden? Willst du es
anderen auch noch unmöglich machen? Wink
Ansonsten: Such mal nach std::islower() in deiner Compiler-Doku.

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Thomas Maeder
Guest





PostPosted: Mon Nov 24, 2003 9:00 pm    Post subject: Re: kleine buchstaben Reply with quote

Christian Lackas <delta (AT) lackas (DOT) net> writes:

Quote:
#include <iostream
#include using namespace std;
int main() {
char j;
while ( cin >> j && !cin.eof() && (isupper(j) || !isalpha(j)) )

Die <cctype>-Funktionen nehmen allesamt ein Argument vom Typ int, welches
entweder gleich EOF sein oder einen unsigned char-Wert haben muss. Wenn
char signed ist, hat das Programm undefiniertes Verhalten, sobald j
ausserhalb des unsigned char-Bereichs liegt. Und das ist schnell geschehen,
z.B. durch Eingabe eines Umlauts, wenn die Zeichen mit ISO 8859-1 codiert
sind.

Zudem scheint mir die Überprüfung && !cin.eof() überflüssig.

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.