The first exercise of mine:/* Write a C-program to print the vaue of
the alphabet when an integet value is entered .. For example if 1 is
entered then A must be printed on the screen,if 2 is printed then B
must be printed...like this so on......*/ 11 1608 va*******@gmail.com wrote:
The first exercise of mine:/* Write a C-program to print the vaue of
the alphabet when an integet value is entered .. For example if 1 is
entered then A must be printed on the screen,if 2 is printed then B
must be printed...like this so on......*/
Do you have a question?
--
Eric Sosman es*****@acm-dot-org.invalid
<va*******@gmail.comwrote in message
news:11**********************@b75g2000hsg.googlegr oups.com...
The first exercise of mine:/* Write a C-program to print the vaue of
the alphabet when an integet value is entered .. For example if 1 is
entered then A must be printed on the screen,if 2 is printed then B
must be printed...like this so on......*/
Hints:
const char array[] = "Hello";
printf("%c\n", array[0]);
printf("%c\n", array[1]);
printf("%d\n", 0 + 1);
-Mike va*******@gmail.com wrote:
The first exercise of mine:/* Write a C-program to print the vaue of
the alphabet when an integet value is entered .. For example if 1 is
entered then A must be printed on the screen,if 2 is printed then B
must be printed...like this so on......*/
What a dumb exercise. You need to throw away the material from which
you got that exercise and buy a good C text like K&R2.
santosh wrote: va*******@gmail.com wrote:
The first exercise of mine:/* Write a C-program to print the vaue of
the alphabet when an integet value is entered .. For example if 1 is
entered then A must be printed on the screen,if 2 is printed then B
must be printed...like this so on......*/
What a dumb exercise. You need to throw away the material from which
you got that exercise and buy a good C text like K&R2.
Most newbie exercises are fairly dumb. I don't see any particular
objection to this one.
Brian va*******@gmail.com wrote:
>
The first exercise of mine:/* Write a C-program to print the vaue of
the alphabet when an integet value is entered .. For example if 1 is
entered then A must be printed on the screen,if 2 is printed then B
must be printed...like this so on......*/
/* BEGIN new.c */
#include <stdio.h>
int main(void)
{
int integet_value, rc;
puts("Enter an integer from 1 to 26.");
rc = scanf("%d", &integet_value);
while (rc == 1 && integet_value 0 && 27 integet_value) {
printf("The number %d letter of the alphabet is %c.\n\n",
integet_value,
" ABCDEFGHIJKLMNOPQRSTUVWYXYZ"[integet_value]);
puts("Enter an integer from 1 to 26 to continue\n"
"or any other integer to quit.");
rc = scanf("%d", &integet_value);
}
return 0;
}
/* END new.c */
--
pete
"Default User" <de***********@yahoo.comwrote in message
>va*******@gmail.com wrote:
The first exercise of mine:/* Write a C-program to print the vaue of
the alphabet when an integet value is entered .. For example if 1 is
entered then A must be printed on the screen,if 2 is printed then B
must be printed...like this so on......*/
What a dumb exercise. You need to throw away the material from which you got that exercise and buy a good C text like K&R2.
Most newbie exercises are fairly dumb. I don't see any particular
objection to this one.
It tempts the newbie to assume that the character encoding is in
alphabetical order.
--
Free games and programming goodies. http://www.personal.leeds.ac.uk/~bgy1mm
Malcolm McLean wrote:
"Default User" <de***********@yahoo.comwrote in message
>>va*******@gmail.com wrote:
The first exercise of mine:/* Write a C-program to print the vaue of the alphabet when an integet value is entered .. For example if 1 is entered then A must be printed on the screen,if 2 is printed then B must be printed...like this so on......*/
What a dumb exercise. You need to throw away the material from which you got that exercise and buy a good C text like K&R2.
Most newbie exercises are fairly dumb. I don't see any particular objection to this one.
It tempts the newbie to assume that the character encoding is in
alphabetical order.
On the contrary, it demonstrates how to avoid such (erroneous)
assumptions.
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
--
Posted via a free Usenet account from http://www.teranews.com
Malcolm McLean wrote:
"Default User" <de***********@yahoo.comwrote in message
>>va*******@gmail.com wrote: The first exercise of mine:/* Write a C-program to print the vaue of the alphabet when an integet value is entered .. For example if 1 is entered then A must be printed on the screen,if 2 is printed then B must be printed...like this so on......*/
What a dumb exercise. You need to throw away the material from which you got that exercise and buy a good C text like K&R2.
Most newbie exercises are fairly dumb. I don't see any particular objection to this one.
It tempts the newbie to assume that the character encoding is in
alphabetical order.
... and offers an learning opportunity in overturning the
tempting assumption.
Temptation need not be a bad thing; read "The Man That
Corrupted Hadleyburg."
--
Eric Sosman es*****@acm-dot-org.invalid
Malcolm McLean wrote:
"Default User" <de***********@yahoo.comwrote in message
va*******@gmail.com wrote: The first exercise of mine:/* Write a C-program to print the vaue
of >>the alphabet when an integet value is entered .. For example
if 1 is >>entered then A must be printed on the screen,if 2 is
printed then B >>must be printed...like this so on......*/
>
What a dumb exercise. You need to throw away the material from
which you got that exercise and buy a good C text like K&R2.
Most newbie exercises are fairly dumb. I don't see any particular
objection to this one.
It tempts the newbie to assume that the character encoding is in
alphabetical order.
I don't see how. There is such a thing as alphabetical order, and
mapping that to integers seems natural. It doesn't say anything about
the order of alpha characters in the particular character encoding used.
If the student solved the problem in a way that used ASCII or
something, then they should be marked down for a non-portable solution.
There is a fairly straight-forward method that achieves it portably.
Brian
pete skrev:
va*******@gmail.com wrote:
>The first exercise of mine:/* Write a C-program to print the vaue of the alphabet when an integet value is entered .. For example if 1 is entered then A must be printed on the screen,if 2 is printed then B must be printed...like this so on......*/
/* BEGIN new.c */
#include <stdio.h>
int main(void)
{
int integet_value, rc;
puts("Enter an integer from 1 to 26.");
You probably mean: "Enter an integet...".
rc = scanf("%d", &integet_value);
while (rc == 1 && integet_value 0 && 27 integet_value) {
printf("The number %d letter of the alphabet is %c.\n\n",
integet_value,
" ABCDEFGHIJKLMNOPQRSTUVWYXYZ"[integet_value]);
puts("Enter an integer from 1 to 26 to continue\n"
"or any other integer to quit.");
rc = scanf("%d", &integet_value);
}
return 0;
}
/* END new.c */
August
August Karlstrom wrote:
>
pete skrev:
va*******@gmail.com wrote:
The first exercise of mine: /* Write a C-program to print the vaue of
the alphabet when an integet value is entered ..
For example if 1 is
entered then A must be printed on the screen,if 2 is printed then B
must be printed...like this so on......*/
/* BEGIN new.c */
#include <stdio.h>
int main(void)
{
int integet_value, rc;
puts("Enter an integer from 1 to 26.");
You probably mean: "Enter an integet...".
I try to be careful, but sometimes I slip up.
rc = scanf("%d", &integet_value);
while (rc == 1 && integet_value 0 && 27 integet_value) {
--
pete This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: |-|erc |
last post by:
Hi!
Small challenge for you.
The index.php uses this file and calls layout(). Take a look at www.chatty.net this file
draws the chat login box on the right. I traced the CHAT button it submits...
|
by: Fuzzyman |
last post by:
Hello,
To create a classic (old style) class, I write :
class foo:
pass
To do the equivalent as a new style class, I write :
class foo(object):
|
by: vasanth kumar |
last post by:
I am using Microsoft for my Database
I entered the data in the database table
but, when I print this data on html page thro' asp script. I don't see my
new lines. I tried by storing <br>(html...
|
by: nitin |
last post by:
g++ -c $INCLUDES ActualPEResult.cpp
In file included from /usr/include/c++/3.2.2/backward/iostream.h:31,
from
/home/pradeepks/Linux_Porting/dcpfrontier/dcpdev/dcp_components/trap...
|
by: susmita_ganguly |
last post by:
Hi
I am trying to upgrade from oracle 8i to oracle 9i on the same server
..I don't know much abt migration .
Can anyone help me out.
Thanks.
Susmita
|
by: cs168 |
last post by:
Hi I am new in ASP programming so I do use the very basic and simple way to do all my stuff. Now I do really got stuck at how can I loop thru the calculation for all my selection.. My full code is as...
|
by: Vasanth |
last post by:
Hi:
I am using Sun JdbcOdbcDriver to access MS-Access from Java client on
Windows platform. We are in the process of migrating from Win to
Solaris and AIX platform. MS-Access will continue to...
|
by: dog |
last post by:
I've seen plenty of articles on this topic but none of them have been
able to solve my problem.
I am working with an Access 97 database on an NT4.0 machine, which has
many Access reports.
I...
|
by: lgbjr |
last post by:
Hello All,
I¡¯m using a context menu associated with some pictureboxes to provide
copy/paste functionality. Copying the image to the clipboard was easy. But
pasting an image from the clipboard...
|
by: vasanthvn |
last post by:
Thanks for the replies....Can it be done by using data files..like
by ....first we have to create the file ...in the file we must write
the details like 1 for A and 2 for B and then so on...and...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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,...
|
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...
|
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...
|
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...
| |