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

How many times during registration were you pointed to The Rules? Why would you ignore them?

When reading an integer, cin leaves the \n in the buffer. The next cin sees that and continues on thinking it was his. You have to clear the input stream before reading strings if they are followed by reading numbers.

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

Don't spam the board with the same question multiple times. Once is enough.

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

How do i go about getting a table in there. we have not covered this in class.

Then it's not something you want to do. It's not easy at your level of experience.

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

Stop using the type double everytime you reference a variable. Once you say double varname you only need to use varname from that point on.

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

Read your textbook. It's in there.

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

Yes, it's a plan. It's basically like a blueprint that you follow to actually write the program. It makes programming easier and faster.

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

Huh! for code tags a keystroke makes no sense at all. What in the world is that supposed to mean anyway. I think someone needs an English refresher with that runon sentence.
a keystroke would help a whole lot. would help what a whole lot ? It that talking about a hotkey, such as press Ctrl+A and it'll post the code tags around the code ?

Rephrase for you, AD:
I would like to see a keystroke added that would insert CODE tags (just like the CTRL codes for BOLD and ITALIC). Then we won't have to remove our hands from the keyboard just to click an icon Nor would we have to type [CO[B][/B]DE=xxx][/CODE], saving at least 15 keystrokes.

Better?

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

Please, you need more consistent formatting. See this for ideas, especially the use of indentation (TABs vs. SPACES for one)

Also, don't use system("pause") when there are better solutions...

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

WaltP....believe it or not....some professors still stick to the old way of teaching/programing...

Oh, I'm fully aware of that!!!

I agree with Salem: shameful! Would you learn to drive from someone using a Model-T cranker? Would you learn to cook from someone that only uses a toaster oven? Why do they allow instructors to teach programming with equally lacking tools (rhetorical question). Let's all learn to high dive from the guy with the kiddie pool!

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

I think I am a little confused now and I need some input from you guys. I was under the impression that the main problem is that the questions are just the same newbie questions over and over again and there's nothing stimulating going on.

No, not from my side. These questions will always be around. No, the problem is no one reads any of the "how to" posts. There's "the Rules", then there's the "We only give homework help to those who show effort" and "Announcement: Please use BB Code and Inlinecode tags " announcements. Then they need to read Narue's "Read Me: Read This Before Posting". And lastly, Aia's " Guide to proper code tagging using pictures". No wonder no one reads anything -- they aren't required to. It's only suggested.

Pull all the most important pieces together in a short, easy-to-read post with links for additional help, and for the first 10 posts pop up a question asking "Did you read this yet? If not, please do so before continuing". If they then posts crap, we can infract them, slap their wrists, humiliate them, depending on who gets there first. And #1, do not tell us you are a noob! We don't care!!!

However, you're now telling me that forums are always going to only be newbie questions because the advanced users can typically answer their own questions, and that the main problem is the way they ask questions (ie 1337 speak and no code …

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

Also: #include<iostream.h> -- old header that shouldn't be used for the past umpteen years #include<conio.h> -- header that should not be used as it's not portable void main() -- main() has NEVER been a void, always an int, see this clrscr(); -- useless function only defined in 1 old compiler, no other compiler has it. getch(); -- another function that should be avoided, only a couple compilers have defined it.

You need a newer book. I hope you aren't learning from an instructor.

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

Also: #include<iostream.h> -- old header that shouldn't be used for the past umpteen years #include<conio.h> -- header that should not be used as it's not portable void main() -- main() has NEVER been a void, always an int, see this clrscr(); -- useless function only defined in 1 old compiler, no other compiler has it. getch(); -- another function that should be avoided, only a couple compilers have defined it.

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

In addition to what Salem suggests, define optimized in your context.

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

After you check the root, you have to check the next node. If less, move left, if greater, move right. Check that node. If less... ad nauseum... until you run into your -1. That's where the new node goes.

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

I find it interesting that someone with 300 posts and in a discussion on a "read the rules" thread hasn't read the first paragraph of this rule:

it's late thats y u are confused, give it time it will sink in, if each new user come to the site is directed to a section that show all community with solved threads we would not ahve the repitions in the forum, just like a knowledge base, for eg u go to dell to get help on a pc u select your make and model, then you sellect what category of help u want, u gettting the pic my queen,

:icon_wink:

Salem commented: Now that's entertainment! +13
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I may ask something else later so I m not marking it as solved as I may have further problems.

When you do, please consider formatting your code. It will help you in the long run. It will help us in the short run. :icon_wink:

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

Have you bothered reading the Rules and Read Me: Read This Before Posting? This was suggested multiple times when you registered.

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

Yes, we can help, once you've read the rules as you were asked many times diring your registration process.

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

I would have left it.... :icon_twisted:

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

I like it, Salem!

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

No dice. Is there a header I need to include?

Headers don't do anything. The problem is cin requires input when you specify a variable. You can't enter nothing. Using cin.getline() will work, though.

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

okay so the second part of this assingment is: Using a sort routine of your choice, sort the numbers in each of the rows of the array and display the sorted numbers again on 5 lines of 10 numbers each


i have no idea how to do this...in a 2d array. please help!

You can't do this part until you get the first part done. Did you? If so, we can't see the code...

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

[[I]Hard-handed response[/I]]
If they've been told about the rules that many times, infract them!
[/Hard-handed response] :icon_twisted:

I know it's not nice, but that's how I'm feeling today.:icon_redface:

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

Lately I've been seeing the following:

Today I was looking at forums until about 2:45PM. This evening about 7:30PM I clicked on the Go to first new post on various threads. I scroll up to previous posts and see many that have been added from 4PM on. Why are these posts not the first unread? Do I have a setting wrong?

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

Hi, i have to programm this in c++ can anyone please help me and give me the code for this...

IF SOME ONE CAN HELP ME WITH THIS AND SEND ME THE CODE I WILL BE VERY GREATFULL TO THAT PERSON.

So you just want to be lazy and have someone do it for you, eh? The going rate is $30.00 an hour to GIVE code to someone -- unless this isn't homework. If it's not homework, it $60.00 an hour. AND DON'T SHOUT! IT'S RUDE!

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

sorry, I should have said I changed it to this,

char *getString(char *string) {
	scanf("%199s",string);
	return string;
}

to provide for the null char. Thanks again:)

We still recommend:

char *getString(char *string) {
	[B]fgets(string, 200,stdio);[/B]
	return string;
}

It's just too easy to make a mistake with scanf() . And why do you need to pull in the and execute the parsing for %d, %u, %i, %g, etc when fgets() requires nothing extra but reading a string. Safely.

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

Use the string as an array. Let's say you just read the string and you're looking for the first 'w':

searchchr = 'w';
i = 0;
while (line[i] != searchchr)
{
    i++;
}

Now you can move everything up to the 'w' into another variable with .substr()

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

Well, disarray() is meaningless, isn't it? Call it shuffle() :icon_wink:

Make the function to shuffle the cards in a new program. When you get the shuffle function working, simply add it to you program.

Pass what you want shuffled (the source array) into the function.
Use rand() to move that array into a temporary array as the shuffling mechanism.
Move the temp array back into the source array.


And

And when you say format, are you referring to my code?? Or my messaging...

Did you look at the link? That's why the words were in blue :icon_rolleyes:

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

One out of three questions answered. Want to go for two out of three?

You didn't read that link, did you?

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

The same way you do it by hand. You just have to tell the computer every step you did by hand in minute detail.

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

i got an issue of creating a QUEUE of integers in a circular array using C

to insert, remove, display, show

CAN ANYBODY HELP ME OUT HERE

In the Community Feedback forum? I don't think so...

Can't you find a better place to post this question?

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

I need to do a stack of strings but im getting problems can anyone help

...

The errors im getting:
Error 1 error C2440: 'initializing' : cannot convert from 'std::string' to 'size_t' g:\pf iii\stacks\stacks\stack.cpp 23

stackArray = new string[value]; String is not an array, and value is not a number. Look up new again.

Error 2 error C2440: '=' : cannot convert from 'std::string' to 'int' g:\pf iii\stacks\stacks\stack.cpp 24

stackVal = value; What type of variables are these?

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

Yes, getline is correct. and use string . It has find and substring functions that will help split the string into values.

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

Format!!! Format!!! Format!!! Please!!!

You need srand() to initialize the random generator (use once at the program's start) and rand() to get a random value.

And where is your shuffle routine?

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

Do you honestly think that that unformatted code is going to be helpful over a month later?
And what is so difficult in understanding the post titled Read Me: Read This Before Posting? Is it not explicit enough?

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

Hello,
I don't know bandit_77, but I am also trying to write the exact program that he requested help on. I doubt I know as much as the original poster because I am very new to programming. So the answer to the "goldilocks" problem is, ""Woah, back up Einstein, I'm new at this" Although, unlike bandit, I am willing to give it a try.

I am having trouble coming up with a way to "test if it's above '9', and if it is reset it to '0' and add 1 to the next column. If a letter, test for 'Z'" as WaltP suggested.

Here is my first attempt. Be warned it's pretty ugly and my compiler just about had a heart attack after trying to compile it :$

#include <stdio.h>

main()

{
	char license_plate[6]; = "0123456789abcdef"
	int i;

	for ( i = 0 ; i < 10 ; i++ ) {
  printf( "The next license Plate is=%06d\n", i );
}

	while (?)

	{
		printf("Please enter the license plate >");
	        scanf("%s", license_plate);
		

	
	}
}

I know it is a mess. I'm pretty sure some things are out of place in there. I'm going to pick up a "C for dummies book" tomorrow. Thanks.

Hey!! At least you used CODE tags!!! Bravo!!!

Since you're new to programming, learn to format your code NOW! Don't wait.... It'll come in handy later.

First thing to understand is the relationship of ASCII digits and letters to their value. Every character has …

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

Maybe it would help to ask the person that actually wrote the code for you than having us try to figure out what he meant when he wrote it.

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

here is my code. I don't know why it always returns the value that i do not ask for.?? This code display the name I typed in if it is inside the array.

Probably because you returned the value you didn't want.

Because you didn't explain
1) what you wanted
2) what the program did
3) where the error is
there's not much to tell you.

I guess you didn't understand the information listed in the post at the top of the forum titled "Read Me: Read This Before Posting", eh?

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

First of all, please learn to format your code.

Are you trying to add all the i*j values together? If so, all you did is add the very last i and j values based on the loops. That's going to be 9+9 = 18. You need to add i*j to the running total. Something like total = total + (i * j) or thereabouts.

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

I'm confused, too.

Confusion #1: Why don't new posters ever read the post Read Me: Read This Before Posting? Isn't the title explicit enough?

Confusion #2: No idea what your problem is. I have no idea what "I donot see how to read 3 separate values, store them but not add them" means. It can't be something as simple as just don't add them, I assume.

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

Why did you post this question twice?

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

Depends on what your definition of binary number is. A string with all 1's and 0's? An integer value containing only 1's and 0's? Or an integer that you can display as binary?

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

i don't know how to fix this error can any one help me

here's my code:

StringStack::StringStack(string value)
{
	stackArray = new string[value];
	stackVal = value;
	top = -1;
}

top is undefined.
stackVal is undefined.
No idea what line the errors are on.
What can we say?

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

Let me correct my last post. It says that the 'read' does not take 1 parameter. I assume that means I need something like infile.read(text, ios::binary);

This is why we ask you to paste the exact error message rather than post your interpretation of the message :icon_wink:

Since I just got here, I have no idea what you now need to do. Asking a specific question when you post the code is helpful.

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

Hi.

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

I will assume by the added comment...
I also am going to assume ...

I wouldn't. I've wasted my time making assumptions... :icon_wink:

Since you don't want to explain what's going on, just start putting output statements in your code to see if the values are correct as the program executes.

And Read This! before you post again.

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

Use an array initialized to underscores. Then for each letter guessed correctly, replace the appropriate values with the letter guessed. Then you can output this array.

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

Hello there, I have here a bit of confusion with fread. I have here a .cue file generated in windows. I tried to read through the entire file in windows and when I printed the buffer, it gives me the correct content of the file, but when I read it in linux, it skips one letter. Any ideas why? Thanks. :)

First letter? Last letter? The 25th letter? 12th letter on line 4?
Did you read this?