WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Yes, C++ would be good.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Get rid of the "ton of IF statements"...

Each character has a value ('0'=48; '1'=49...)
To convert a digit character to an int, subtract '0'. num = chr - '0'; Do this for each character entered.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
myfunc(&array[0]);

This complexity is not necessary. myfunc(array); is enough.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

strcat()

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

IOW, look up the iomanip settings

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Write a boolean truth table for while ( ans != 'n' || ans != 'N' );

jephthah commented: heh. +7
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

strncpy_s(userId, email_address.c_str(), 9); copies your email domain into user ID. Whatever was there is overwritten.

By the way, just use the strncpy() function. strncpy_s() is non-standard, non-portable, not a good choice to use.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

#include<iostream.h> -- old, do not use
The current header (as of the 1990's) is simply iostream #include<conio.h> -- Non-portable, not standard, do not use void main() -- main() is an int function, not a void. See this clrscr(); -- Non-portable, not standard, do not use tnt[i]=atoi(take[i]); -- Does atoi() take a single character? Look it up.

If the character is >= '0' and <= '9', it's a digit. To convert a digit to a number, subtract '0'. Each of these character are just special numbers so you can do math on them.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Start by writing a program that reads the file one character at a time and write it to the screen. If you can do that, you're half-way there.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

dunno where shud i start..but am having real trouble understanding file handling...

Do you have a book? Start at the beginning of the chapter on file handling. Read it until you get to something you don't understand and then ask for clarification. We need to know what you need help with. We already know that you need help (you started a thread, that's how we know).

Also, please write full English sentences, otherwise your posts are very hard to read.

Gee, I was gonna say that! :icon_twisted:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Learn to format your code properly and the error will be readily apparent.

After that, if you need more help, you need to tell us what's wrong. We didn't write the code, you did. Explain.

tux4life commented: Exactly :) +8
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You've been asked before to use proper formatting. Your code is an absolute mess. Please format your code properly so we can see the flow.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

btw, you guys wouldn't have any book recommendations would you?

No... We don't recommend books. Oh, and ignore that post at the top of the forum titled "Read Me: C++ Books" :)

Ancient Dragon commented: LOL +28
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I take it my suggestion didn't help at all.

Please note how hard it is to read your posted code. If you'd use 4 SPACEs instead of a TAB for your indentation, it would be much easier to read -- and it's more industry standard. I've never seen a company that indents a full TAB.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Im have trouble complete on what i have. Looking for some idea's I'm getting a exit error and don't know what to do? Please Help

With what? Do you have a problem? Did you tell us what that problem is? If you did, I missed it somewhere in the explanation.

Please use [code] tags.....

Why? If you don't format anything, it looks the same with or without CODE tags. Unreadable. So always format your code

Also, here we don't post answers to questions. We help them find their own answers. They learn more.

Salem commented: Yes! +20
VernonDozier commented: Not sure what the down votes were about. This post seems good to me. +11
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

yes.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Create a header file with: extern int array[]; in it and include the header in the .cpp file without the array declaration..

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

As AD said. Since you are printing non-printable characters, you can't very well print them, so you have to print something else in it's place.

Add the value 'A' to the character if it's < SPACE and do as The Dragon suggests: putchar(ch + 'A'); Also, PLEASE format your code better. Indenting 50 spaces and inconsistently makes your code almost unreadable. See this

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

OK. I did it. Where do I send it to get graded?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

It looks OK to me. Have you tried the easiest debugging of all? Use cout to tell you what's happening as you progress through the program. After the switch output a message. After a read, output the data. Stuff like that. Put them where you think the trouble spots are.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Nope, this came out Apr 14 or so.

Close enough for government work.... :icon_wink:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

The kids behind the counter at the burger place give you the senior discount, without your asking for it.

Ouch!

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

April Fools! I hope... :icon_rolleyes:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

And I said format your code. I see what you did and can't read it. Therefore I can't help solve anything.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I'm going to assume the above post was posted by mistake since a new thread was started with the same code.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Did you remove the trailing '\n' from your input string using fgets() ? It's always good to examine the data read to see if there are anomalies in your console input. There usually are... strstr() is used to search a string. It looks like you simply need strcmp() .

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Please format your code. Whatever problem you are having can probably be attributed to the fact you can't see what you're doing.

See this

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I've just read a few books on C++ and learned a lot about the language, but the books never mentioned how to add sound and visuals to my programs.

That's because C++ doesn't actually do graphics or audio. It's simply a programming language.

I "think" that stuff is all stored in libraries, but...

Very true. You find the libraries you want to use and add it to your C++ programming environment. Then you have graphics capability.

what tutorial should I read next to learn how to implement graphics/sound into my programs?

This I can't help with. But someone will come along with some good advice (and others with bad -- hope you can tell the difference :icon_wink:)

Also, I do just use a library right? or is it relatively easy to write my own graphics/sound library?

It is very difficult to write your own libraries. Stick with a good package that comes well recommended.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I have changed a few things around. Still not completely working.

Maybe you're using the wrong logic.

If you want to ask a question, ask a detailed question and you'll get help.

If you want us to say "Awww, poor program :'(" post a statement like you did with no indication of what's not working.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

i want to make this game....and i need help....in the game computer should play as a second player....and it should also win....is that possible....and is it easy???

Yes. Except for the win part.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

what can I do?

About what? Test the program might be a good idea.

oh and I also need to take the transaction types and subtract from them to put them into all_cents which will be my final average...

So do it? What have you tried? Show us. I'm not looking through 200 lines of code for something as vague as this.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

After the page in your text that opens the file should be the page that teaches how to read the file. Try that... :icon_rolleyes:

[edit]
Looking back, it looks like you already know how to read the file. You've done it before. Maybe you should look back to the beginning of your thread, too.
[/edit]

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You need to read and study pointers. This link is a good tutorial
-- Ancient Dragon

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

What two things are wrong with this line scanf("%d", &abc[30]); ???

hint for 1: you have defined abc as a character array, didn't you?

You need to study the printf() function closer...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Didn't say that. I said it's not C++. It's an advanced form of coding, well worth researching. MFC may be part of Visual C, I'm just not certain never having used it. FLTK may be easier and it will teach you concepts needed, then you can advance to another platform closer to industry standards.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You haven't been through 4th Grade math yet? Do you honestly not know how to figure the average of, say, 26,30,37?

Hint - 31.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

C++ has nothing to do with making Windows. It barely knows about the console and keyboard. All that windowing stuff is system dependent and C++ simply taps into that system substructure either via API calls, add-on Windowing systems like MFC, OWL, FLTK, and others.

So you need to research the GUI techniques and choose a GUI System to learn. I hear FLTK is good, and fairly easy.

Salem commented: Nice +20
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I do not know why every post that i put...there are always controversies..maybe my question was ambiguous..

The more details you give -- with examples, restrictions, and when/where/what, the less ambiguous your question. Remember, only you know what you're doing. If you don't explain it to us well enough, controversy happens.

jephthah commented: controversy! woot! +7
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Start by writing some code that inputs the number from the user.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Hey!! I gotten the hang of C programming, logic design n all.. But am having real trouble understanding C++ concepts... My sems are up in a month! Any suggestions on how do i get it done before that???

With that lack of specifics, I would suggest a general study harder and ask more questions.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

can any1 give me a tip ..?

Sure. Explain exactly what happens and what should have happened. Tell us where the problem is so we have an idea where to look.

In general, if you want help, explain in detail what the problem is. Don't leave it to us to figure what's happening. Tell us.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

String.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

How is this

My data file is showing as this when I open in a text pad.

-858993460
-9.25596e+061
5.43402e-304

Are those numbers correct? If so, it may be working. If not, it's not working.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Wasn't the offending line Triangle(int side1,int side2,int side3); ?
Why is it still in the code?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Umm, we haven't reached the point in the class which tells us how to read in a string and convert or reorder data.

Reordering the data take an editor. You edit the file so the data is in a different order so you can read it properly using the program.

Can I use getline(infile, title)?
Thank you

Yes.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
cout << "Enter Major: "
cin << major;
major = toupper(ch);
cout << "Enter Threshold: "

How do you get major into cin? Is your << wrong? And if so, check the next line, too.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

When using >> to read something, Only 1 word is read.You'll need to look at other options for reading multiple-word titles.

One idea is to read the entire line as a string and find the Price, Quantity, and Discount and convert them.

Another idea (easiest) is to reorder the file so the Title is at the end of each line. Then you can read the numbers and then the rest of the line as the title.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Do you have an actual question or do you just like making new copies of your checksum code for the fun of it? You don't have to quote the same post over and over and over.

And if we don't know what you want, posting code with not details at all is not going to help.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I'd do something more along the lines of

IF m >12 or m < 1 then 
        return invalidmonth
IF d > 31 or d < 1 then
        return invalidday
etc