473,587 Members | 2,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

some questions from a freshman

Greetings,

im Danilo, a student from TUP Manila and taking up COMPUTER SCIENCE. we
are going to have a defense or we could say a project in turbo c. i
just wanna know how to use the SWITCH FUNCTION cause we really need it
badly.

about the array in the interger type variables, what if i put this:
int num[15];
then print some statements so that the user can put some values
printf("put number/s:");
HOW can i put the number/s in the variable "num"?
scanf("???????? ?????????");
i dont know how what to put in there or should i write puts than scanf?

thx in advance.

Feb 19 '06 #1
1 1618
danilo of TUP wrote:
Greetings,

im Danilo, a student from TUP Manila and taking up COMPUTER SCIENCE. we
are going to have a defense or we could say a project in turbo c. i
just wanna know how to use the SWITCH FUNCTION cause we really need it
badly.

about the array in the interger type variables, what if i put this:
int num[15];
then print some statements so that the user can put some values
printf("put number/s:");
HOW can i put the number/s in the variable "num"?
scanf("???????? ?????????");
i dont know how what to put in there or should i write puts than scanf?


Your English is not exactly lucid, but I'll do my best.

Firstly, you're asking very basic questions like getting input, filling
an array and so on. It would be better for you to acquire a good book
on C and go through it. If you have trouble with any exercises, then
you can post them here for clarification.

The switch is not a fuction but rather a statement. It general form is:

switch (expression) {
case label: statement1; statement2; ...
case label: statement1; ...
default: statement1; ....
}

The expression 'expression' is evaluated and execution branches to the
case statement that contains a 'label' whose value matches the
evaluated expression. This allows multiple branches from a single
expression.

As for filling an array, typically, you employ a loop like the FOR or
WHILE, containing a prompt, a call to a function like fgets() and then
further checking and conversion of the value.

While for demo programs a simple call to scanf() would be sufficient,
in any worthwhile code, fgets() followed by sscanf() or
strtol()/strtod() etc would be needed. Importantly, you should check
wether each function you've called has succeeded or failed and act
appropriately.

For storing signed integer values you can use:
scanf( "%d", &integer_var );

At this point either work through a hardcopy or online book on C. Then
as questions arise, you can post here.

Feb 19 '06 #2

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

Similar topics

2
2000
by: Ross Micheals | last post by:
All I have some general .NET questions that I'm looking for some help with. Some of these questions (like the first) are ones that I've seen various conflicting information on, or questions that I'm not sure are specific anomolies that I'm having, or if they are specific known issues I'm facing. 1. In VB.NET, are arrays stored on the stack...
1
1808
by: Tony Johansson | last post by:
Hello Experts! I have some questions about inheritance that I want to have an answer to. It says "Abstract superclasses define a behavioral pattern without specifying the implementation" I know that an abstract class doesn't have any implementaion even if a default implementatiion can be supplied for pure virtual methods. What does it...
50
4328
by: Jatinder | last post by:
I 'm a professional looking for the job.In interview these questions were asked with some others which I answered.But some of them left unanswered.Plz help. Here are some questions on C/C++, OS internals? Q1 . What is the use of pointer to an array? Q2 . What is the use of array of pointers? Q3 . What is the use of pointer to function ?...
24
1690
by: Kevin | last post by:
Hey guys. I'm looking to get together some VB programmers on Yahoo messenger. I sit at a computer and program all day. I have about 3 or 4 people already, but it would be really cool to have a much larger list of people (for all of us to benefit). I have found it to be an invaluable resource to answer those hard or weird programming...
7
2349
by: changs | last post by:
Hi, all I have a asm code, I suspect it sort of socket programming. Can anyone here give some instructions on how to determine the function or give the psudo-code in C? Thanks in advance! Tony
1
1472
by: RADAR | last post by:
I Am A Freshman In Java And I Want To Know How Do I Start And Where Do I Start. If It Is Required,i Have Intermediate Level On C Programming.any Comments Which Has Good Decisions Are Excepted. Thanks For Now Regrats,r@d@r
3
1637
by: iKiLL | last post by:
Hi all I am building an Windows Mobile 5 forms control in C#, for a Windows Mobile 5 application. I am using CF2.0 and SQL Mobile 2005. The control is a Questions and answer control.
4
1584
by: Mr. X. | last post by:
Hello. I need some help, please. What can an employee ask (technical questions), if I am interviewed of Dot-net developer (also VB.NET and C#). (What are the most general questions, that I may be asked ?) Is there a site that has some questions & answers ? Thanks :)
2
2087
wbgxx
by: wbgxx | last post by:
I'm a freshman and have study algorithm not 1 month,can some tell me more about hash table?thanks!
0
7843
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...
0
8206
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. ...
0
8340
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...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
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...
1
5713
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
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...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.