Horn wrote:
[color=blue]
> I am having trouble comparing strings. When I run the program and I
> type in what I think is the right string, it goes to the else part of
> the program. This is for my computer science class in high school so
> excuse me if you think it's really easy. If you know what I should do
> then please send me a message at
hornstar12@email.com[/color]
I won't, and it's rude to ask. Post here, read here.
[color=blue]
>
> //Britton Horn
>
> #include "stdafx.h"[/color]
Incomplete code makes it difficult to diagnose problems. You haven't
given us the contents of this header file.
[color=blue]
> #include <iostream.h>[/color]
This is not a standard C++ header. Standard C++ uses <iostream>.
[color=blue]
> #include <stdlib.h>[/color]
This header is deprecated in favor of <cstdlib>.
[color=blue]
> #ifndef _OOSTRING_H
> #define _OOSTRING_H[/color]
This is illegal. You may not use identifiers beginning with an
underscore followed by either another underscore or an uppercase letter.
They are reserved for the implementation's use. Even if your compiler
fails to diagnose this (most won't), it is an error. A compiler may
reject the code, or may even accept it with a dramatically altered meaning.
The simplest rule of thumb is *never use an identifier that begins with
an underscore, or contains a sequence of two underscores.*
Besides that, "include guards" make no sense in a non-header file.
[color=blue]
> #include <string.h>[/color]
This header is deprecated in favor of <cstring>, but you should just use
<string> and the std::string class instead (as others have already said).
-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.