473,473 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ERROR MESSAGES

Hllo to everyone, this is a folow up of my mathematical expression
assignment.i was tod to do one thing at a time , that i m doing and
have a better derstnding of the whole thing.someone asked me to use
standard libary ,to store my ror messeges instead o arrays. i have a
trial here.please is it a good one, i need your comments.
const char EnterExp = "Please give an expession and press the ENTER
key";

const char result= " The Answer is: ";

const char DivByZero= "WARNING!!!:No Division by Zero;Check answer.";

const char FloatPtNo = "WARNING!!!:No decimal points
allowed,discarded.";

Jul 22 '05 #1
5 1143

"stanlo" <mu******@yahoo.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
Hllo to everyone, this is a folow up of my mathematical expression
assignment.
I'm afraid nobody is going to be able to offer much help
if you don't give the *exact* description of your assignment.
i was tod to do one thing at a time , that i m doing and
have a better derstnding of the whole thing.
But imo your understanding of C++ is still very lacking.
someone asked me to use
standard libary ,to store my ror messeges instead o arrays. i have a
trial here.please is it a good one, i need your comments.
We need a coherent explanation of your assignment.


const char EnterExp = "Please give an expession and press the ENTER
key";
This is not valid. You're trying to store a pointer value
into a type 'char' object.

const char result= " The Answer is: ";
And again.

const char DivByZero= "WARNING!!!:No Division by Zero;Check answer.";
And again.

const char FloatPtNo = "WARNING!!!:No decimal points
allowed,discarded.";


And again.

I think you need to go back and spend some serious time with
your textbook, and try to write some much simpler programs
before you're able to tackle this.

-Mike
Jul 22 '05 #2
stanlo wrote:
Hllo to everyone, this is a folow up of my mathematical expression
assignment.i was tod to do one thing at a time , that i m doing and
have a better derstnding of the whole thing.someone asked me to use
standard libary ,to store my ror messeges instead o arrays. i have a
trial here.please is it a good one, i need your comments.
const char EnterExp = "Please give an expession and press the ENTER
key";

const char result= " The Answer is: ";

const char DivByZero= "WARNING!!!:No Division by Zero;Check answer.";

const char FloatPtNo = "WARNING!!!:No decimal points
allowed,discarded.";

No, that won't work. You are making variable constants which can only
hold one character.

Use
const char *EnterExp = "Please ...";

Those who suggested you used standard libraries most likely wanted you
to use std::string, which is far, far easier to use than the "const
char*" type string. You can get it by inserting
#include <string>
at the top of your file.
Jul 22 '05 #3
On Sat, 08 Jan 2005 18:15:30 +0100 in comp.lang.c++, Morten Aune
Lyrstad <mo****@wantsno.spam> wrote,
No, that won't work. You are making variable constants which can only
hold one character.

Use
const char *EnterExp = "Please ...";


No need for the gratuitous pointer. Prefer

const char EnterExp[] = "Please ...";

Jul 22 '05 #4
"David Harmon" <so****@netcom.com> wrote...
On Sat, 08 Jan 2005 18:15:30 +0100 in comp.lang.c++, Morten Aune
Lyrstad <mo****@wantsno.spam> wrote,
No, that won't work. You are making variable constants which can only
hold one character.

Use
const char *EnterExp = "Please ...";


No need for the gratuitous pointer. Prefer

const char EnterExp[] = "Please ...";


Why? Why did you use the term "gratuitous"? No, I am not trying
to pick a fight. I really want to know. Perhaps you will include
that in your answer, but in case you don't, why prefer an array
over a pointer, if the pointer is never assigned to? Or is it only
to prevent assigning to it?

V
Jul 22 '05 #5
On Sat, 8 Jan 2005 15:28:33 -0500 in comp.lang.c++, "Victor Bazarov"
<v.********@comAcast.net> wrote,
Use
const char *EnterExp = "Please ...";


No need for the gratuitous pointer. Prefer

const char EnterExp[] = "Please ...";


Why? Why did you use the term "gratuitous"?


The pointer occupies an extra sizeof(char *) bytes of memory.
Gratuitous = not being used in any way that adds to the
functionality of the program. As you point out, the pointer is
never assigned to, so why do you need it?

The (char *) has external linkage and the pointer value is not
const, so I suspect that only a heroic optimizer could do anything
to avoid loading it whenever it is used.

On the other hand, the array location is a compile-time constant,
and ought to be accessible from any kind of code with no extra
overhead.

Jul 22 '05 #6

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

Similar topics

2
by: lkrubner | last post by:
This is a general computer question, but I'm writing in PHP so I'll post this to comp.lang.php. I've been writing a content management system. I've a Singleton object that keeps track of all...
5
by: Steve | last post by:
Hi; I went to the microsoft site to try to find a guide to the error messages that the jdbc drivers give ( for sqlserver 2000 ). I had no luck. Does anyone know if there is such a guide? ...
10
by: DataBard007 | last post by:
Hello Access Gurus: I use Win98SE and Access97. I just built a simple Access97 application which holds all contact information for my personal contacts, such as first name, last name, address,...
10
by: Brian Conway | last post by:
I have no idea what is going on. I have a Login screen where someone types in their login information and this populates a datagrid based off of the login. Works great in debug and test through...
0
by: Janning Vygen | last post by:
Hi, i have a question about how to handle postgresql constraint errors in the client app. I found some mails in the archive about it, too. But i have still so many questions about how to do it,...
8
by: Brian Tkatch | last post by:
Server: DB2/SUN 8.1.6 Client: DB2 Connect Personal Edition (No 11) <URL:ftp://ftp.software.ibm.com/ps/products/db2/fixes2/english-us/db2winIA32v8/fixpak/FP11_WR21365/FP11_WR21365_CONPE.exe> ...
16
by: lawrence k | last post by:
I've made it habit to check all returns in my code, and usually, on most projects, I'll have an error function that reports error messages to some central location. I recently worked on a project...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
2
by: FutureShock | last post by:
I am using a registration class to process a registration form and need some opinions on returning error messages. I am self referring the page on submit. I would like to send each form field...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
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...
0
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...
0
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,...
1
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...
0
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...
0
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,...
0
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...
0
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...
0
muto222
php
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.