473,624 Members | 2,564 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Letter question

11 New Member
How to make a program that says enter calculation. If a person enters non-numeric letter to say "That is an invalid operation"
Sep 14 '09 #1
6 1698
JosAH
11,448 Recognized Expert MVP
@IgorZ
Check the isdigit() macro from the ctype.h file. For convenience first read in the entire line and check all the chars in it. Note that this gives you a necessary check that still isn't sufficient.

kind regards,

Jos
Sep 14 '09 #2
Tassos Souris
152 New Member
Exactly.. if you must support floating point numbers going through the characters and manually checking with isdigit() is not so *promising*..

See at the function strtod() strtol() in header <stdlib.h>
To read the line use fgets() and not gets() or scanf().
Sep 14 '09 #3
JosAH
11,448 Recognized Expert MVP
@Tassos Souris
Lexical analysis is a burden, even if you only want to recognize ints; what if the user types eighty nines in a row? Theoretically it's an int. It won't fit in four or even eight bytes though ...

kind regards,

Jos
Sep 14 '09 #4
Tassos Souris
152 New Member
I agree.. personally i use doubles and strtod() when i need to.. strtod()
notifies when an overflow or underflow occurs :)
Sep 14 '09 #5
IgorZ
11 New Member
How about when a person enters a letter instantly to delete it? Is that possible?
Sep 15 '09 #6
Savage
1,764 Recognized Expert Top Contributor
@IgorZ
ungetc() may help, check this out.

You will ofcourse need to modify the sample a bit ^^
Sep 15 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

12
6016
by: Alan J. Flavell | last post by:
OK, today's email brought a comment from a reader, pointing out something that I'd long since noticed myself but hadn't done anything about it. On my pages, I've got a first-letter style on paragraphs. So far, so good: some of the paragraphs begin with a link, and there are styles in the stylesheet for link, hover etc. The first letter is still displayed as styled for the paragraph's first-letter.
4
3027
by: Ian | last post by:
I am using Access 97 SR1, when I move my database to another PC some or all of the reports change from English A4 to American Letter. I am sure this has been addressed many times but I cant find any references to it, any help would be appreciated. (Sorry if I have sent this twice, also having problems with news groups, most of the time I get "unrecognised response from server", I wonder if there is a news group about problems with...
2
1607
by: JLeonard | last post by:
I would like to save my Access form letters as a txt file who's file name matches the value in a 'last name' field. One file for each record. Any ideas for how I might do this? Thanks in advance! -- JL
4
12515
by: George Thompson | last post by:
How can I retrieve the first letter of data in a field within access? (using access 2k?) is this a VB thing or is there an obvious solution?
0
1639
by: Gidi | last post by:
Hi, i'm writing this question again, since i didn't get an answer in the reply i wrote, i hope it's ok. My user default language is hebrew and in some specific TextBoxs i want that the default language will be english. I asked here and the answer i got was that the best way to do so, is by getting the Hebrew Letter and Change it to it's parallel English letter on the keyboard. i didn't such a function (with switch and case) but i'm...
2
3370
by: Colin Halliday | last post by:
I have a Word 2003 mail merge main document (form letter) that is linked to another Word document data source for the mail merge. If I open this doc using the Word GUI, it first asks me to confirm that I want to run a query to select the data from the data source file, then it opens the form letter fine. I can preview the merged records and complete a merge to a new document. I have a VB 2006 project (.net framework 2.0) which opens the...
9
2230
by: Ulterior | last post by:
Hi, everyone, I have a simple problem, which bothers me for some while. I will try to explain it - There is some string, whith different letters in it. Is it possible to analyse this string and the reffer to it knowing that it has some certain letters in it using only some integer value?
3
1771
by: =?ISO-8859-2?Q?Miros=B3aw?= Makowiecki | last post by:
How do it's by next of boost.spirit library it are not discrimitation a letter size that a small letters and big letters it are not discrimitation? I'm know how write s small parser by next of boost.spirit but at above a establishment I do not know! Thanks in advice.
2
1982
by: sehodge | last post by:
<STYLE type="text/css"> P { font-size: 10pt; color:#000;} P:first-letter { font-size: 150%; color:red; font-weight: bold; float: left } </STYLE> Later, I want the first letter to be color:green. And still later, I don't want the first letter to be 150%. I want it to be reset to 10pt If I add another <STYLE later in my html to change the color to green, all the first letters change to green - even those above the...
2
1642
dlite922
by: dlite922 | last post by:
Before i spend hours coding this thing, i want to see if there's already a solution or one of you has built something close to it. Please suggest anything that may relate to any of the following Goal: The user creates letter and report templates and executes it and it will print the letter and report based on the criteria (usually date range or person information) I want the user to modify the report and letter templates through the...
0
8168
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
8614
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
8471
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...
1
6107
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5561
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
4075
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4167
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1474
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.