473,804 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1767
In article <06************ *************** *******@m36g200 0hse.googlegrou ps.com>,
Niall 84 <ni**********@y ahoo.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.program mer.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
4107
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 all companies between year 2000-2005 in my website http://www.geocities.com/allinterviewquestion/ So please have a look and make use of it.
0
4604
by: connectrajesh | last post by:
INTERVIEWINFO.NET http://www.interviewinfo.net FREE WEB SITE AND SERVICE FOR JOB SEEKERS /FRESH GRADUATES NO ADVERTISEMENT
2
7230
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 yourself. This will help you judge yourself are you really worth of attending interviews. If you own a company best way to judge if the candidate is worth of it. http://www.questpond.com/InterviewRatingSheet.zip
4
2514
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 cross-posting. I am trying to build a "checklist", where a user can navigate to an ASP page on the intranet which shows a list of "questions" that the user can check off. I am trying to figure out how to do this so that it is scalable, but I am...
11
3627
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
7990
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 to catch up again with Python. I am now appearing for Job Interviews these days and I am wondering if anybody of you appeared for a Python Interview. Can you please share the questions you were asked. That will be great help to me.
0
1506
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 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers7.html C# Interview Questions and Answers 6 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers-6.html C# Interview Questions and Answers 5...
1
1627
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 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers7.html C# Interview Questions and Answers 6 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers-6.html C# Interview Questions and Answers 5...
0
4517
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 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers7.html C# Interview Questions and Answers 6 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers-6.html C# Interview Questions and Answers 5...
0
9593
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10595
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9169
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.