In article <06**********************************@m36g2000hse. googlegroups.com>,
Niall 84 <ni**********@yahoo.comwrote:
>Hi all,
Haven't done C or C++ in a few years and have never done a huge amount
of it.
I'm trying to do some very basic programmes at the moment to get back
into it.
Not really related to your questions, but you should check out
<http://www.c-faq.com/>.
Carefully reading through the whole thing won't be time wasted; if
you're in a hurry, at least look through the table of contents so you
know what's there for when you run into questions that it answers.
>1st of all I'm using Microsoft Visual C++ (2005 I think). Can this be
used as a C compiler or is it just C++?
Very probably. Most compilers that support both languages make their
decision based on the filename. The people in
comp.os.ms-windows.programmer.win32 or in a MSVC-specific newsgroup
will be able to give you details if you can't figure it out yourself.
>I am also trying to use the scanf to take back in a value but it seems
to be giving me problems. its giving a warning about using it
Depending on what that warning is, it may or may not be safe to ignore
it.
If it's complaining about using a function that hasn't been declared,
or about the arguments not matching what they're supposed to be, it
probably means there's an error in your code.
If it's complaining that scanf itself is somehow bad, then you should
try to find a way to turn that warning off. (Especially if you can do
it without turning off similar warnings for gets, which *is* inherently
bad.)
For nontrivial user input, scanf is usually not what you actually want
to use anyways. The C FAQ has details on the problems with scanf and
on alternate ways of getting input.
and also
when I do execute it (Using a different programme to MSVC) as soon as
I put in an input the window closes instead of displaying what it
should display after my scanf.
Solution #1 (portable, but suboptimal): At the end of main(), when
your program has finished what it's actually meant to do, print a
"Press Enter to continue" prompt and wait for (then discard) user input
before you terminate. (This may turn up one of the aforementioned
problems with scanf.)
Solution #2 (probably better): Configure your IDE to leave the
program's window open until you close it. comp.lang.c is not the place
to find out how to do this.
dave
--
Dave Vandervies dj3vande at eskimo dot com
But I don't daydream about being a [paramedic], because my subconscious knows
that learning to fly unassisted is more likely than my being capable of being
a paramedic. --David Cameron Staples in the scary devil monastery