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

My questions are:
Is this a bad cut & paste?
If not:
Who wants you to deal with this piece of trash code?
When will you ever do something like this (and keep your job)?
Why do people insist on teaching this crap?

Salem commented: Great unanswered questions of our time.... +19
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Write a VB system that connects to a genetic machine that makes clones whose sole purpose it to use your database.

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

It can be easily seen through common language and in literature that the word is uncommon.

Only in your limited scope of the world. There are words I know you've never heard in common use -- they just aren't used in your particular area.

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

the prototype of main is already written in the header files.

He said it was solved.

u hv not written void main()

No he not wrtn tht. Dun writ leet spk, use ful engsh so ppl wth bd englsh cn unnerstnd. This is part of the Forum Rules.

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

Probably an error in translation :)

Nope. Translation is fine. It is gauche. And it's uber-gauche to use goto :icon_wink:

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

Oh, you are a real winner....

please test and run it for me please i have to go sleep now...

Did I read this right? You really posted your code and you want us to test it for you? Yes, you are presumptuous. It's not our problem it's due Friday...

I said:

Do one at a time and test test test!!

Well, you did all 4 and didn't test it once. And just by looking this won't even compile.

If you decide to actually use the help you've been given, I'll help. As it is, I'm wasting my time. Good luck.

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

That first return statement is shown indented a lot, but I have it fine in my code. It pasted strangely,

Convert TABs to 4 SPACEs. TABs don't work well on forums.

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

assign5.cpp:83: error: too many arguments to function âvoid Sort(cStudent (&)[30], int)â

Well, the function Sort has more parameters in the call than the function is designed to take.

Hope that helps...

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

Figure out 4 parts of the program -- 4 segments of distinct functionality (input, output, etc.)
Copy the code for each section and create a function around it. What data needs to be given to the function that used to be in main() and is now missing? Add those as parameters. Do one at a time and test test test!!

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

I don't understand. First you say

For example:
I have the str1 = "Jhon" and str2 = "Lucas"

Then you say

but if my string was like that: "35:Jhon\135:Lucas"

So which is it?

The escape does not works well because the 35.

So what's wrong with the 35?

What I do?

Depends on what the problem is.

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

my function was working all fine and dandy but boring until my friend separated the function for me which we are suppose(required by teacher) to do and now my program stops after i enter the first and last name ( i was the one that added multiple return 0;) i am running out of time this is due friday and i have to draw flow charts for these please help me

Your first problem is you let your friend change your code without knowing what he did. If it's your code, you need to make the changes -- and understand what your changes are. Go back to what was working before your friend tried to help.

Second, the purpose of the flowchart is to design and understand the program needed, then code the program from that design. You don't write the program then make a flowchart to fit. It's much easier starting with the flowchart.

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

Thanks All for helping me ..

In YouTube c++ tutorial I saw person using "Code::Blocks" IDE when programming with SDL lib, What are the additional features, which "Code::Blocks" IDE gives me compared with C++ 2008 express IDE ..?

Nothing worth worrying about. You still have to write the code yourself.

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

Thanks Fbody for trying help me, I paste your corrected code but compiler gave me error:

Proof positive -- if you give an answer to someone, they will just copy and paste your solution into their code rather than try to understand what you wrote and fix their code.

iammfa (and others), use your brain, not ours.

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

nput a number between 1-9, then choose 2 character, e.g: * and =.
The sample output:
Enter number: 5
Enter character: * =
*
==
***
====
*****

I had tried many times, but don't know where i was doing wrongly. Please help, thanks!

We don't know what you're doing wrongly either because only you know what you are trying to do.

This is like going to the doctor and telling him "I hurt somewhere. Fix me."

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

i think i have the best one

You violate Salem's 2nd rule and you think your solution is better? Think again.
And your switch statement is terrible. And you used scanf("%s",str); , too. Very dangerous...

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

Good idea jonsca

Salem commented: Score! +19
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

check this code

OK...

#include<stdio.h>
# include <stdlib.h>
int main()
{
    int x = 0;
	printf("plz enter a number : ");

Improper English. It's spelled "Please"

scanf("%d",&x);
	
	int y = 2 , z = 0;
	int * factors = (int*)malloc(100 * sizeof(int));

Declaring variables after executable statements is illegal in Standard C -- at least with most C compilers in use.

while (x != 1)
	{
		if (x % y == 0)
		{
			x = x /y;
			factors[z] = y;
			z++;
		}
		else y++;
	}
	z--;
	int a = 0;
	while (a <= z)
	{
		printf("%d ",factors[a]);
		a++;
	}
	
    return 0;
}

Finally, what does finding the factors of a number have to do with the factorial of a number?


Other than that, it is nicely formatted. Unfortunately, you attempted to do his homework for him. We don't do that here. We help them write their own code.

Nick Evan commented: Nice one :) +12
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

My initial reaction is it needs whitespace.
1) Indent 3-4 spaces, not 1
2) More spaces on a line for (int j = 0; j < dim2; j++) c.mat[i][j] += this->mat[i][k] * x.mat[k][j]; 3) Blank lines between logical sections

Makes the program more readable.

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

Leap was great too. Too bad they edited out the copyrighted music for the DVDs. Same with Greatest American Hero.

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

Diners, Drive-ins and Dives -- Food Network

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

Isn't a vector automatically sorted? Or am I thinking of something else?

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

That will work but a function should really stick to only doin one thing... either calculation or cout, since this is not a complex task.

float circle_area(float radius)
{
	return PI * radius * radius;
}

Then do the cout's in main

This thread needs no more help. The thread ended in 2005. I'm sure the OP is no longer waiting...

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

By comparing them to Batman and Robin you are in fact delegating one to Robin(inferior; and the other Batman ie superior). They might become mad with you.

They'll get over it... Just don't ell them.

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

Depends on what you're trying to do. With all the '#' signs and no formatting, the code is too hard to follow without some explanation. Plus you should always explain what you're doing and not force us to read, understand, digest, and debug your code. Remember, we didn't write it so we don't know it.

And use the PREVIEW button to make sure your post looks good.

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

In cCourselist::Load() , why are you passing in Infile ? If you aren't using it anywhere else, just define it locally where you need it.

Same with Outfile .

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

Just delete all the lines that don't start with double.... .

Restating exactly what you said before is not "Thinking through your question carefully..."

Last warning about CODE Tags, too.

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

You forgot the #endif The correct way of doing what? What are you trying to do?

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

How many questions have been asked/answered about QT so far?

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

You have to pick one of your threads, don't just keep adding to both.

sorry.... was a mistake... reply here... or there... anywhere is fine.....

No it isn't. "Anywhere is fine" doesn't solve the problem.

Other thread closed. Problem now solved.

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

Not a clue what you want. Think through your question carefully and give us enough information to understand the problem you're having.

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

No, what the problem is your understanding of numbers.

10.1 is identical to 10.10 is identical to 10.1000000
Each is 10 and 1 tenth. It doesn't matter how many zeros you add.

Therefore, 10.5 (10 and 5 tenths) > 10.10000000

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

The way I read the files from a directory was similar to:

$filhnd = @opendir($dirname);
    if (!$filhnd)
    {
        printf ("<b>Directory [%s] not opened </b><br />", $dirname);
    }
    else
    {
        while ($fil = readdir($filhnd))
        {
##        now $fil contains a filename from the directory.
##        It could be anything, even a subdirectory name
##        so you have some testing to do.  
##        Then if the filename is worth saving:
             $filelist[] = trim($fil);
        }
        closedir($filhnd);
    }
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Nothing. I don't eat anymore. It's bad for my health.

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

Of the both, who is like the Spiderman and who is the seabiscuit?

Seabiscuit -- look at cast.

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

When they pass in the list address to delete, if it hasn't been initialized, don't delete it. Return an error code.

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

I have a page with a navigation column and a data column that I wish to control separately, both sides use forms. When I scroll down and click on a button on navigation side I want the data side to change accordingly but I want the nav side to stay put (no repositioning).

My first two thoughts is frames or separate windows -- either is fine for me. But how can I control the data side from the nav side? Can I send a PHP script command to another frame/window or can PHP only affect the current window?

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

Thanks. I switched the order of the cout statement and sort call, and now I get 10 -numbers and 10 random numbers sorted. Not sure why the first ten are messed up though?! Thoughts?

My thought is "why the first ten are messed up" explains nothing? No one but you know what that means...

You now are sorting the numbers as you get them. In other words

Get number 1
Sort it
Output it
Get number 2
Sort them
Output #2
...

Don't you want to
-- Get the numbers
-- Sort them all
-- Output them all?

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

Although I think it could be called before main.

Impossible. Nothing can be called before main()

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

I am refering to the index [0] to [9]:

[0]	[1]	[2]	[3]	[4]	[5]	[6]	[7]	[8]	[9]
56	78	3	72	99	47	50	0	30	56

If digits are lesser than or equal to 40, digits will move towards the left of index [0], [1], [2] ...etc

As of now, my output is not moving at all.

I still have no idea what you're trying to do. A compete example from input to output is needed, including how to decide what goes where.

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

With what? You gave us nothing to help with. Did you forget to read the Rules and the sticky posts at the beginning of the forum?

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

You mean like
Batman and Robin?
The Tick and Arthur?
Thelma and Louise?
Spiderman and Seabiscuit?

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

"I am trying to display an array of digits using rand.
My final result need to be:
1) Output all digits <=40 to the left side of array
2) Output digits > 40 to the right side of array

I was unaware arrays had sides. What do you mean?

Prob: The random digits does seems to change & result incorrect

Random digits are supposed to change. That's why they are called random.
And what makes the result incorrect? I have no idea what's correct nor incorrect to go by.

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

Just saw it tonight. If the crust shifts 23 deg and brings China close enough that the plane can land without getting wet, why were the mountains untouched? Seems to me the shift would cause massive destruction there, too.

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

Your program tried to access outside the bounds of your variables -- for example trying to access var[20] when the definition is int var[10];

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

Because in C you can't assign a string to a single character: name[25] = "unknown"; state[25] = "unkown"; You need to look into the function strcpy() .

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

I just realize you have it static. Of course it wouldn't work.

You do not want your variable to be [B]static[/B] .

Your code:

static int lowest_num;
  static int  next_num;

Do you listen this well in class too?

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

Also, notice that your case function looks like this :

switch(number)
{
  case 1: //blah
  case 2: //blah
}

There is a problem with that. The problem is that you used constant
numbers in your switch case. Usually, those numbers means something,
so making a const variable for those number, would make your code
better. Its better to get into a good habit early.
So for example, you can do something like this :

const int QUIT = -1;
const int GET_BANK_NAME = 1;
const int GET_STATE_NAME = 2;
const int PRINT_NET_WORTH = 3;

See how much more readable and better it looks?

But it will never compile. Did you forget this was the C forum? :icon_wink:

#define QUIT = -1;
#define GET_BANK_NAME = 1;
#define GET_STATE_NAME = 2;
#define PRINT_NET_WORTH = 3;

is C. There is no problem with using constant (called hardcoded) numbers in a switch statement. You are correct though that constants are a good habit to get into... :icon_wink:

Anyway this suggestion does nothing to fix your logic problem. And since you didn't tell us what happens that makes you think there is a logic problem, what can we tell you? No info = no ideas generally

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

My password is always the day of the week my password was created. I tell people that, too, because it's not like they'll know what day of the week I created it. That makes it secure. Extremely secure.

Really? Give me 7 guesses... :icon_rolleyes:

Nick Evan commented: hehe +0
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

no i'm not callin main anywhere...

Guess my psychic powers were on the fritz....

Please consider reading the Rules and Sticky posts that describe how to ask for help. For one, CODE tags are described
1) in the Rules you were asked to read when you registered
2) in the text at the top of this forum
3) in the announcement at the top of this forum titled Please use BB Code and Inlinecode tags
4) in the sticky post above titled Read Me: Read This Before Posting
5) any place CODE tags were used, even in responses to your posts
6) Even on the background of the box you actually typed your message in!
so you can't miss them -- only ignore them.

And posting almost 400 lines of code and expecting us to try to figure out
1) What you're trying to do
2) What is wrong
3) Where it's wrong
4) How to fix it
just is not appropriate. Help us. Try to pinpoint where it's wrong, it's your job to give us enough details to understand the problem.


[edit]

hey i'm sorry tat i've to leave now.....
so please look over my code and reply me where have i made a mistake...
will reply u later..

Ahhh, another "here, you fix it for me while I go do something else" request. Figures.

Salem commented: Well said +19
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Rewrite your look so you don't call main() to start the loop again.