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

OK, then. Get ready:
Set the textbox to a nonproportional font.
Figure out how many characters can fit across in the box
Count the characters in both fields
Subtract that value from the number of characters the box can hold
Add that many spaces between the fields

Copy the textbox.text field into the email.

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

there is only one text box , aligning left or right will make align both coloumn in either way.

A textbox does not have columns.

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

When dealing with pointers, the "&" sign is called the address-of urinary operator. Knowing it's name sure helps to understand when to use it. Is "*" a urinary operator as well, and if so, what is its name? If it is not an operator, then what is it?

Thanks.

Urinary? I know these questions piss off some people, but really! :icon_twisted:

To answer your question, see this. Google is your friend.

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

my confusion is as syntax of thread creation is
pthread_create(
pthread_t *thread,
const pthread_attr_t *attr,
void *(*func)(void *),
void *arg);
how i use two arguments
int argc,char * argv[]) in it

CODE TAGS!!!! Use them!

Which parameter in the pthread_create() call is the *argv[] parameter? Same with argc. Start there.

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

Were 3 identical answers really necessary? :icon_rolleyes:

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

Just to clarify, Walt, let me restate the rule so there is no confusion on your part:

Do ensure that all posts contain relevant content and substance and are not simply vehicles for external links, including signature links

Posts that are not relevant and/or have no substance and act as vehicles for external links break the rule.

Posts that are not relevant and/or have no substance but do not have external links do not break the rule.

As Nick says, being stupid isn't currently a crime. Those posters who do not break this, or any other rule, but otherwise fall into the annoying dumbass category should be dealt with by way of a guiding hand PM from the mods which serves to gently prod them in the right direction towards becoming a valuable member of the community.

Ahhh, then the rule is backwards. As stated, content is of primary import for all posts and links is secondary. Your description explains that the links are the most important and content must be existent IFF you post with links.

Therefore the rule needs to be restated more like
Do ensure that all posts that contain external links, including signature links, also contain relevant content and substance
to accurately describe the rule.


Sorry for being pedantic here, but if I'm confused by a rule, many others (especially the stupid) will probably not understand the rule. I'm simply trying to make it understandable to all, including us mods, so …

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

>> Do ensure that all posts contain relevant content and substance
>> and are not simply vehicles for external links, including signature links

Not necessarily an either/or. What about people who post stuff like you just posted ("thank you diz iz greeeeat post!") but who don't have an ulterior motive like spamming, but rather just an imbecile who, while possibly thinking he is adding something, isn't. Does the inane post lacking substance break a rule in and of itself? Other than the leet-speak?

Do ensure that all posts contain relevant content and substance is the rule.
and are not simply vehicles for external links, including signature links is simply a dangling statement that has no real bearing on the rule. The 'rule' includes many types of posts that are not allowed, whereas the dangling statement includes only one explicit type and therefore confuses the rule. Restating the rule without the confusion:
Do ensure that all posts contain relevant content and substance. For example, posts that are simply vehicles for external links (including signature links) are not allowed.

IMAO.... :icon_wink:

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

Since when is main() a char function? Of all the errors I've seen for main() , this is the first time for this one...

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

Print the data and see. Your best test to see if something worked is to look at the values by displaying them, or using the debugger.

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

What problem? We didn't write the code so we don't know if it's right or wrong either. It might help to tell us what you're having problems with. We aren't psychic -- we're programmers.

Salem commented: But I knew you would say those things... +17
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

the problem is in this portion of the code

scanf("%c",&choice1);

try puting a space betewee " and %C when declaring the variable type char, this sometimes refuses to accept the input and porceeds to the end or enters a random input instead

try replacing that piece of code with this one and see what hapens

scanf(" %c",&choice1);

And how would that help? Why would the correct way (before your change) 'refuse' to accept input?

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

I don't understand your logic here:

printf("Do you want to enter another contact?Y/N\n");/*condition question of loop*/
	scanf("%c",&choice2);
	if (choice2 == 'y' || 'Y'){
		choice2 == 'y';
	}else{
		break;
	}
	}while(choice2 ==  'Y' || choice2 == 'y');

Accept [I]choice2[/I] If [I]choice2[/I] is eith 'y' or 'Y', change it to 'y' -- this is nonsensical - it's already 'y' or 'Y' otherwise exit the DO-WHILE loop At end of DO-WHILE, test for 'y' or 'Y' -- you just set it to 'y', so you know it must be true. It can't be anything else because if it was you already broke out of the loop. And why test for 'Y'? You set it to 'y' so it can't possibly be 'Y'.

In other words remove the IF statement completely. It's redundant, unnecessary, and extraneous.

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

thanks, i will work with all your sollutions and see what will bring the desired result in this case
its all about the result not how you got it in programing isnt it ???

thanks anyway

Not necessarily. You can get to New York to Philadelphia by way of Cleveland, but just because you got there, is that an acceptable route?

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

The usual way of computing min and max goes like this, in pseudocode:

cur_min = a-number-at-least-as-big-as-the-data-minimum // INT_MAX works
cur_max = a-number-at-least-as-small-as-the-data-maximum // INT_MIN works

I would start out slightly differently:

cur_min = first-number-in-the-array 
cur_max = first-number-in-the-array

This way you don't have to guess at a hopefully large/small enough number. And the first number in the array could be the largest or smallest. And it's part of the list anyway.

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

well, i tweaked it, an added an option for the user to enter a number and depending on the number, a certain variation of the array will be shown....but i havsin some difficulties....could anyone help me as to where i went wrong?

The first thing you did wrong is expect us to read your mind. "i havsin some difficulties" doesn't tell us anything. You need to tell is what the problem is.

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

Output your variables at key points in your code.

What's the value of argv[1]? Is it correct?
After diddling with filename, what's it's value? Is it correct?
Did the open on filename work?

There is nothing anywhere in computing called a Degbug. Copy and paste the exact error, and the code, into one post. And explain exactly how you got the error.

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

Also, never copy stuff to argv[]. That's a system-defined array, not for user storage. Consider it an input-only value.

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

I know it has to do with the way I an assigning filename and argv. argv is a pointer...

Yes it is.

... and filnaame is an array. I might be using the wrong type for the filename

No it's not. char *filename = new char [100]; defines a pointer that gets the address of a character array created from the heap. Why are you doing this? Why not just char filename[100]; :icon_question:

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

Again with "having error". Like it gives the wrong answer? It doesn't compile? It burns the coffee? It destroys Tokyo? Some idea of what "error" means would be helpful.

And now that you've fixed it with the IF, please fix your formatting.

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

Try entering an invalid file name.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
do
   {
	  in1.open(argv[1], ios::binary);
           if (!in1)
           cout << "That is not a valid file.  Try again!\n";

   } while (!in1);

interesting loop. Try to open the file named in argv[1]. If it doesn't open, try to open the file named in argv[1]. If it doesn't open, try to open the file named in argv[1]. If it doesn't open, try to open the file named in argv[1]. If it doesn't open, ... You might want to rethink that.

After running the program it works but I keep getting an error message about my variable "filename".

Well, then something is wrong. Give us the info we need to understand the what "an error message" might mean. I can think of 5-10 things.

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

Then, after you do what Adak suggested, on a piece of paper draw 2 empty matrices labeled arr and barr. Label the left sides and tops based on the indices used in the program posted. Now follow the program line by line, recording values of all the variables.

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

If you are going to post a question, and you get responses, read the damn posts! You have been told how to fix this. By me and the compiler.

If they are teaching you to use void main() and iostream.h you can either
1) Find a new instructor that will teach current coding practices
2) Understand that you are learning how to program 1980's code and your knowledge of programming will be severely handicapped when done.

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

Updating your Mingw and [getting] rid of what came with your IDE will not help. The problems will still occur with an updated compiler.

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

No wonder you're confused.

I am using Dev-C++ and when I am trying to compile a program in it, it is showing many errors. All the settings seems to be right. Can I compile a program including header files like conio.h and iostream.h and using namespace std in Dev-C++?

You are using 3 different eras of programming

  • 1980's - conio.h from non-Standard C programming. Suggestion - remove it and all functions used from it.
  • Pre-standard C++ using iostream.h -- again old and substandard. Upgrade to iostream, no extension.
  • namespace std for use with today's standard headers with no extension.

Decide what era you want to compile and fix the code to that standard.

confused_one commented: thank you sir for your suggestion +0
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Oh really??? Where are they then? The only links to code snippets any more are from within the member's profile. But I don't want to search 50,000+ member's profiles just to find tutorials and/or code snippets.

908,364 Members profiles :icon_wink:

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

If IDE A has a tab spacing length of 2 and IDE B has a tab spacing of 4, as long as you are consistent with the tabs, and as long as its only used to indent the code, that alone should be fine. Mixing tabs and spaces is the primary issue.

And when posting on a forum, all bets are off. TABs rarely line up the way you want and given proper (and deep) indentation the code is difficult to read. By converting TABs to a set number of spaces in your IDE, your code will always be readable.

Consider with SPACEs

int main()
{
    int i, j, k;
    printf("Listing: ");
    for (i=1; i< 10; i++)
    {
        for (j=1; j< 10; j++)
        {
            for (k=1; k< 10; k++)
            {
                printf("%d:%d:%d ", i,j,k);
            }
        }
    }
    return 0;
}

vs with TABs

int main()
{
	int i, j, k;
	printf("Listing: ");
	for (i=1; i< 10; i++)
	{
		for (j=1; j< 10; j++)
		{
			for (k=1; k< 10; k++)
			{
				printf("%d:%d:%d ", i,j,k);
			}
		}
	}
	return 0;
}

The second one doesn't look like my editor, and is harder to read.

And if just posting a portion of the code 8 levels deep:

for (k=1; k< 10; k++)
                                    {             
                                        printf("%d:%d:%d ", i,j,k);
                                    }

vs

for (k=1; k< 10; k++)
								{			 
									printf("%d:%d:%d ", i,j,k);
								}

So TABs are evil. So there. :icon_razz:

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

On that kind of IDE, your better off using spaces exclusively or tabs exclusively.

Actually you're (note the spelling) better off using SPACEs. They are always consistent. TABs are not

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

combobox.Keypress

You make your own 'clipboard'

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

Lol I hate to say it but Dev-C++ is a poor choice also, it's buggy and no longer supported as far as I know.

Really? How So?

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

But am helpless without codes i said. And am ready to post my codes, but the problem is that its incomplete and i created now so far that i can understand.... I just waited for the code that suits my requirements.

What this really tells us is "I'm not going to post my code, I need you to write the code for me." Read the Rules.

I thought that the members would be totally confused by my dirty coding.

So how do you clean dirty code? By not asking how and letting someone else write it...

Since I need to create some text files, I tried my codes. But they only encountered in error.

How do you clean up an error? Post the code and EXPLAIN what it does and also EXPLAIN the error.

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

You didn't call the function in the DLL correctly would be my guess.

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

Thanks for all your replies. But can anyone think that these are the reply to my question? Am i helpless regarding this?

Yes, absolutely.

Let's recap. You asked a question giving an example:

...say an incorrect program..:

for(int i=0;i<=12;i++)
{
     ifstream comp("%i.txt");
     comp.close;
}

i know the code is incorrect. But the text document to be created as such 1.txt,2.txt,...12.txt.

OK, that tells us what you are trying to do. Answer was:

You can use a stringstream for this. Try something like...

You said it didn't work. Why? Because:

@ravenous Yep, am using turbo c++ 3.0 version. I know it tat its too old to do. But i hav no more way since i feel difficult to use visual studio. Am not more updated. If i get any proper tutorial i do improve.

you know it's too old. Visual Studio is too hard. If you get instruction you will improve. So you were told:

I heard that Code::Blocks is a good free compiler.

Personally, i'm enjoying using Qt Creator at the moment. It's free, simple and nice to work in. There are versions for Windows, Linux and mac.

There -- two new compilers. Did you try them? Were they too hard? Must be:

Any one pls answer my question for creating multiple text files pls...!

Am using turbo c++ version 3.0 in windows xp platform..

If you want to improve, get a new compiler....

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

sir i have a problem in the c program.

switch(ch)
{
case 1: t=a+b;break;
case 2: t=a-b;break;
case 3: t=a*b;break;
case 4: t=a/b;break;
default:printf("invalid no:");
}

when i execute the program and the any choice the comipler skip to the default statement. is it any problem in the syntax. sir please solve my problem.

Then the value of ch is not 1, 2, 3, nor 4. There's nothing wrong with the code other than being poorly formatted.

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

And why would you want to bother doing anything like this?

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

As I pointed out before, since you are not an Admin, let the Admin deal with these matters. They are going to anyway, so you don't need to post at all.

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

*(mpg+ctr) is basically the same as mpg[ctr] Tearing it apart:
mpg points to the array.
mpg+ctr points to the ctrth element in the array.
*(mpg+ctr) therefore is the value at the ctrth element

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

What's a loop? What does a loop do when it reaches the end of the loop? How does the loop stop?

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

The way you wrote the code, it always returns to the menu. Remove the loop and it won't return to the menu.

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

and if you don't need the command line parameters for your program, explain again how it's better and should always be used?.

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

hi all,

I have this minor problem which is making me go cranky at the mo..

Do other problems make you a little Larry, and others Curly? :icon_rolleyes:

Below is the code which I am working on which takes the test sample values stored in my test 2D array subtracts the centroids stored in centroid 2D array and stores it in temp1 1D array where temp1 goes from 1 to 4. The values in temp1 array are now squared, summed up and storee inside temp1 array again and does this for 2308 times (CLEN). I want to know how I can increment my h index without using another for loop. Where do I initialize it. Before the i for loop or before j for loop?? Please help!!!

Depends on what you are trying to accomplish. Since you calculate values and put them all in temp[h] , it's' difficult to know what you are doing. Maybe an example of the first 12 or 16 temp values (with description) would make your intentions clear.

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

Hey, this is neat! I tried to open this thread in IE to check the problem out and "Internet Explorer cannot display the webpage" is displayed! And i can use the button to "Diagnose Connection Problem"!!!

Leave it to ol' Microsludge to not even work...

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

I get the link displayed in the status bar. No problem here on FireFox.

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

I must have missed something. Where is the description of the problem you are having? Is it hidden somewhere? Or are we supposed to read and understand 300 lines of code with no idea what problem we are looking for?

I have better things to do.

Where's my TV remote...?

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

What did the open file return?

My guess is the program is running in the compiler directory, not the source directory.

Open and write "text.txt" and find out where the file was created.

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

Yes

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

It's because your Illiterate and make silly comments anyway Wenbnet.

Who's illiterate? Literate people know the difference between your and you're.

iamthwee commented: lazyness just lazyness! +0
Ezzaral commented: Exactly what I was thinking too. +0
debasisdas commented: :) +0
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

just recently, since i couldnt get atol(); to work, i actually went and changed atol(const char*); to atol(char); in the stdlib.h file. the program ran but after i entered my equation, the program crashed.

How did you change the atol() code in the run-time library to match your change? Or did you only change the declaration in the header? Think about it...

I recently couldn't get around the lake easily to get to the east side of town, so I changed the city map to have a bridge. But I almost drowned when I took the bridge. What went wrong... :icon_rolleyes:

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

Even though AD explained the problem, I have to add to it:

hey, this is supposed to collect data into a 2 by 3 array. believe it or not, my teacher wrote this problem and he spent 20 minutes trying to figure out why it wasn't running properly. anyone care to help me figure out what was wrong with it??

Given that explanation, what are we supposed to be looking for? "...why it wasn't running properly" means what? What is unproper about it? What are we looking for?

"...what was wrong with it??" depend on what it's doing.

When you need help, please explain what we're looking for, why you claim it's not working. It really saves us from guessing.

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

Well I assumed X (being a 'char') is any letter.

No, it's any value 0 to 255. But which one? If you don't set it, you have no idea.

Ok, so the solution to this would be...

} while (isalpha(integervalue));

Right?

Am I making any sense? :P

That looks like it would work. Did it?


Also: if(integervalue>-9999999999999) What?!?!?!!