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 1606 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: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |