473,396 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Refresher questions in C/C++

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.
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++?
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 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. These are probably very stupid problems
but as I said I forget most of what i've learnt about C!!!!

Thanks,

Niall.
Oct 29 '08 #1
4 1748
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
Oct 29 '08 #2
Niall 84 wrote:
>
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++?
Ask Microsoft, most likely by reading the documentation.
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 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. These are probably very stupid problems
but as I said I forget most of what i've learnt about C!!!!
It also seems that you've forgotten how to make a useful
problem report. Based on the information you've provided, all
I can offer is this tentative diagnosis of what may possibly
be the root cause of your difficulty: "You made a mistake."
My suggested remedy: "Fix it."

If you'd show us the code and the warning and describe how
you ran the program and what you typed and what happened and
how this differed from your expectations, maybe we could help
a wee bit more. Hint, hint, ...

--
Er*********@sun.com
Oct 29 '08 #3
Thank you very much,
I'll check out that C-Faq now.

Niall
Oct 29 '08 #4
Niall 84 wrote:

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++?
Generally, the MSVC suites contain both a C and C++ compiler. If the
file ends in .c, it will compile as C.
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 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. These are probably very stupid problems
but as I said I forget most of what i've learnt about C!!!!
Usually, adding a call to getchar() before the end will be sufficient
for small programs. I assume you're running it by double-clicking. You
can also open a command window and run it that way.


Brian
Oct 29 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: softwareengineer2006 | last post by:
All Interview Questions And Answers 10000 Interview Questions And Answers(C,C++,JAVA,DOTNET,Oracle,SAP) I have listed over 10000 interview questions asked in interview/placement test papers for...
0
by: connectrajesh | last post by:
INTERVIEWINFO.NET http://www.interviewinfo.net FREE WEB SITE AND SERVICE FOR JOB SEEKERS /FRESH GRADUATES NO ADVERTISEMENT
2
by: freepdfforjobs | last post by:
Full eBook with 4000 C#, JAVA,.NET and SQL Server Interview questions http://www.questpond.com/SampleInterviewQuestionBook.zip Download the JAVA , .NET and SQL Server interview sheet and rate...
4
by: Drew | last post by:
I posted this to the asp.db group, but it doesn't look like there is much activity on there, also I noticed that there are a bunch of posts on here pertaining to database and asp. Sorry for...
11
by: gjrw68 | last post by:
I used to code in C about 10 years ago but haven't done anything since than. What's the best refresher site out there for someone who codes daily and needs to get back into C? Cheers, TF
8
by: Krypto | last post by:
Hi, I have used Python for a couple of projects last year and I found it extremely useful. I could write two middle size projects in 2-3 months (part time). Right now I am a bit rusty and trying...
0
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
1
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
0
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.