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

Specify formName.fieldName.data

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

i am using a program that gets run through a windows command prompt and outputs the result to the command line screen by default. i was trying to get it to output the results to a .csv file injstead but i have no idea how to do this.

You have to change the program to make the output come out in CSV format. Ancient Dragon's advice will get the data into a file for you, but it won't be in CSV format. It'll still look like the screen.

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

Just look at the numbers already chosen and if the current value is a duplicate, choose again. This can be done in a loop. You might consider making lblLotto a indexed value instead of separate values.

This way you can set up a for loop to load the numbers and within that a while loop to test for duplicates.

Also, you don't need to bold your posts. We can read them just fine.

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

I am a novice programmer and I didn't think of that. Is it better or more common to do it that way?

I just skipped the zeroeth subscript so the first workday would be 1

Yes, it's more common to actually use the 0th element. If you need 12 elements, it makes less sense to define 13 of them. Especially in the case of a structure that might be -- say -- 1000 total bytes. A big waste of space.

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

It might be easier to accumulate the pay with

set totalpay to hours * straighttime       // this will include ALL hours worked
subtract 8 from hours to get all overtime  // time+half and double
add to totalpay hours * time-and-a-half    // IOW 1/2 of straighttime
subtract 2 from hours to get all doubletime 
add to totalpay hours * time-and-a-half    //another 1/2 of straighttime
                                           // 2 halves = one whole
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Use std::string::substr()...

to break the string into 4 strings of 4 characters. Store them in a string array (or 4 variables if you don't know arrays). Then work with each of the 4 strings.

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

I don't normally post complete homework solutions, but since everyone else is, here's my 2 cents worth

I just gave the solution with a different approach, but well the more the merrier.

Sad... So sad...

Let's all give him his code. He can then just pick the one he likes and turn it in. Nothing solved, nothing gained... :confused:

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

Ok im learning how to do exponents in c++ and I get most of this, but I dont get what double means. I do however know what float is.

It simply means that the storage space (number of bytes) in a double is twice the storage space of a float. This means you can store larger numbers, like long vs. int.

p.s. also for future post's how do u bold your title

You don't. That would be obnoxious. It's like SHOUTING, claiming "urgent", and using pretty colors to try to make your post stand out. Generally makes people avoid your posts.

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

Hope you can help. The following is essentially a small problem of an overall project, i have been trying to work out how to divide an inputted string, into say blocks of 4 characters and then output these separate blocks on the screen. e.g. 1234567891234567 ----> 1234 5678 9123 4567and so on. here's wat i have so far it seem to be working prob.

This is essentially a simple "output 4 characters, output space" loop.

...if i want to manipulate each new string, i would need to split the string?

This is a different problem.
Move each 4 characters into an array of new strings.

in addition to splitting the char string, i need to convert it into its correspong integer e.g. "12345678" --> 12345678. then SPLIT the string and sum the blocks e.g. 1234 + 5678.

Yet another problem. Maybe you''d better post your entire problem, not bits and pieces. It's extremely difficult to help when you keep changing the end result.

What is it you need to do?

What about this

int strLength = str.length()-1; 
char temp[5] = { 0, 0, 0, 0, 0};  // isn't he using C++???
putchar(' ');                     // isn't he using C++???
printf("Final sum %d\n", sum);    // isn't he using C++???

It would help to give him code in the language he needs it. Also, are we writing it for him or are we trying to help him write it himself?

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

I think some major clarificarion is needed.

I was wondering if anyone can help me in terms of using atoi to get my my results to add the 1's of my binary output and then join them together... eg. 110101 and 100101 is 4 and 3 = 43.

Do you mean you want to convert series of 1's and 0's typed in by the user into it's octal (base 8) representation? That's what this example shows. There is nothing decimal (base 10) about it. In decimal, this value is 37, not 43.

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

And...?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
#include <stdio.h>

struct FUN {
    char x;
    char *y;
    int z[20];
};

int main(void) {

    struct FUN fn1;
    struct FUN fn2;
    struct FUN fn3[10];
    struct FUN fn4[50];

return 0;
}

is an assignment like fn4[23] = fn3[5] invalid?

What happened when you tried it? ;)

Set up a function to move the parts of FUN from one value to another.

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

Hey guys, in matlab when u do a loop(something like this):

for i=1:3
a= 2*i
end

You get a=2
a=6
a=9
any idea how do i assign the 3 answers(a) names so that i can calculate the product of all 3 answers?

Maybe:

a = 0
for i=1:3
 a= a * (2*i)
 end
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

It would really help readability if you'd indent more. 1 space is hard to follow -- it's too much like none. Generally the recommendation is 3-4 spaces. Not a hard and fast rule, but a general rule. Readability is the key.

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

When a function is finished, the final statement in the funct can be something like return x; x is the value returned into the variable.

Example:

val = add(a, b);    // add A and B
...

int add (int x, int y)  // define the add function
{
    int z;

    z = x + y;     // add the values
    return z;      // return the value of the addition
}

val will contain the sum when the function is finished.

When you get to functions you will understand -- I hope ;)

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

So the problem was not

When input 2 dates to get the numbers of days between them nothing happens, the program ends....
... again the program ends without printing out the answers.

Did pausing before exit help?

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

thanx waltp.
plz i needed some more informatio regarding those.(final year projects).some more ideas

I don't have any information on them. You asked for names. You need to research what you want to do. I don't even know what constitutes a final year project for your class. Your instructor might know, though.

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

Hello everyone.
What languages are being used for instant messaging?

I use English, personally :D

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

Please add system("pause"); at the end.
So it should loook like this:

...
exit (0); 
} 
system("Pause");
}

No, don't. There is no need to call the operating system when the languave itself can pause the program by simply doing a cin statement.

The assumption here is the program window is closing before you can see the output. Is this a true assumption?

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

I haven't read any of your posts to see what the problem is but it seems to me that if you are

1) Posting your code properly formatted
2) Using code tags
3) Explaining what is going wrong in understandable detail
4) Explaining what the code should do in understandable detail
5) Not making us guess what you are talking about
6) Not expecting to be taught by us (I believe we are here to help, not teach)

you should be having no problems.

[edit]
I just looked at the last two questions you posted and I see a lot of help you've been given. Useful help.

Then you said

NOPE NOT BROKEN I DONT CARE IF I USE CORRECT GRAMER ONLINE AS LONG AS IT GETS THERE AND THE PEOPLE CAN READ IT AND AS FOR ...

which is basically saying you refuse to communicate better and don't really care if half of us can't read your posts. I'm just going to assume you were frustrated and didn't mean to say that. Is that a correct assumption to make?

WolfPack commented: Good Advice +3
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

In this thread WolfPack provide me a link to the online reference manual for the free Digital Mars Compiler that I'm using - which I've found easy to use.

I have never actually used the Digital Mars compiler, but I have never heard anything good about it. I think you'd be better off with DEV-C++ or Borland 5.5 for free. DM seems to have major trouble when you wish to learn Standard C/C++ -- I don't think it conforms to any standard.

http://www.borland.com/downloads/download_cbuilder.html for Borland 5.5
http://www.bloodshed.net for Bloodshed DevC

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

I wasn't responding to DMR, I was responding to Salem.

DMR snuck that in while I was typing...lol.

Oh... :cheesy: That's why I usually quote who I'm responding to. It's really hard to follow generic comments when people sneak in....

But you did use gets() which is still a no-no.

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

Um, the last post in this thread was July 6.

Maybe so, and when I saw answers to two of the posts last night I looked at all his posts and saw 7 of the same thing. Sorry, I didn't look at the dates.

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

Have a variable that holds the item number. Every time the ADD ITEM button is pressed, increment the item number and load the number into the text box. Make the text box 'Enable=FALSE' and it can't be edited.

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

I need everything about visual basic,

Everything? Can you be a little less vague? People that have been writing VB for years don't know everything

i mean code and what is used for?,

Writing programs, solving tasks and problems. Same as any other language.

coz am beginner in that field ...

It shows... Only beginners ask such non-questions as this... ;)

Be specific. What is it you really need to know? Why are you asking about VB? You must kow something about it. Have you tries a book or two?

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

And...

Are we supposed to read your entire program, figure out what's missing, and add it for you?

Shouldn't you maybe tell us what you're completely lost about? What doesn't work, and where the specific area is in the code you posted?

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

I didn't resurrect it...I just answered t. Don't shoot the messenger.

What makes you think DMR was talking specifically to you? "Hello People" was the post salutation. The others could be people, too. :)

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

For professional development which is the best compiler? DevC++ or Turbo c++?

Neither, really, if you are developing professional on the job code. But if you are learning to code, Bloodshed DevC or Borland 5.5 command line is good for the beginner.

Both can create professionall programs, they just aren't used in the profession all that much. The industry for some reason prefers to spend $$$ instead of getting quality free tools.

what is the difference between them?

* Turbo C++ -- very old 16 bit compiler. Works, but so does mouldy cheese.
* Dev C++ -- up to date 32 bit compiler


And what's with the cute colors? Black on white is good enough and not hard on the eyes.

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

Read the post from S.O.S.

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

Where is the loop that allows cin>>final[count++]; to accept more than one value?

Because of the ; on the line

while(count<10 && (reply)=='y');

you have here an endless loop. count and reply are never allowed to change.

It would also help if you start indenting you code properly so you can see what's going on. After each { indent 3-4 spaces, before each } unindent.

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

How many freakin' forums are you spamming with the same lame post?!?! Once is enough, you don't need po make 10 posts all over the place!

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

Craps, poker, PI to 500 digits, proof of perpetual motion, planetary positions at any given date/time, accounting system for a garage.

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

Since word is defined as 5 characters, and you enter "hello", the \0 at the end overwrites memory outside your string. Try increasing the size of word for starters.

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

I've created the following series of If statements that are totally disfunctional. I'm thinking it has to do with my lack of understanding between a function and a statement. (I'm an old mainframe programmer and sometimes have difficulties crossing over)
Even though when I do a watch on the fields, the values are what I expect, the if statement doesn't perform the Then... and the Else on the 3rd errors out.

I see 3 if statements. Can you be less vague? The way you phrased this you could be talking about eny one of them. And what does errors out mean?

... Mid(fName, fposn, 1) = Mid(flname, i)

Are you trying to load multiple characters into one character here? I'm not sure but I believe you might need to rethink this command.

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

As I said...

Instead, figure out how to compile it without the need for the Framework. Then it can run on any Windows computer, with or without .NET

There was web access long before .NET, so don't use technology that is limiting you.

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

Look into string methods, like .find(), .delete(), etc.

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

Instead, figure out how to compile it without the need for the Framework. Then it can run on any Windows computer, with or without .NET

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

Most games are written using the C family. You just need the graphics packages.

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

My preferred solution:

#include<iostream>
using namespace std;
int ReadInputFlava ();
int ReadInputCart ();

int main()
{
    int flava,cart,delivery;

    flava = 0;
    cart = 0;

    cout<<"            Mulaudzi Ice-Cream Limited\n"
        <<"            --------------------------\n";

    flava = ReadInputFlava();
     cart  = ReadInputCart();

    cout<<"Ur flava is : "<<flava<<endl;
    cout<<"Ur # of cartoons is : "<<cart<<endl;

    return 0;

}

int ReadInputFlava ()
{
    int a;
    cout<<"Please enter flavour(1=choco,2=caramel,3=mint) : ";
    cin>>a;

    return a;
}


int ReadInputCart ()
{
    int b;
    cout<<"Please enter number of cartoons(1-20) : ";
    cin>>b;

    return b;
}

This makes the program a little more modular. And I prefer not to pass values via the parameter list unless it can't be avoided. Personal choice.

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

It's a cleaner code method to not include an else unless it's being used.

True, but for the question asked the else was unnessesary to expand because this is an example of how to use isNumeric, not an example of how to design an IF. And all I did was answer the question
asked, I didn't correct his value/text mistake because he would find it quickly enough, and the focus was on the question asked.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
If NOT [B]isNumberic[/B](Textbox1.value) then
    Msgbox("Sorry you must only put numbers")
else
end if
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I think we're getting away from the original question, which was

Guys anyone knows how to check if a value entered in a text box
i.e. text3.text=integer value is integer or long

Doesn't this mean:I have a number in a text box. How can I tell if I need an Integer or a Long when it's converted from ASCII to binary?
Or am I interpreting this wrong?

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

VB is only for PC apps, therefore C. But stick with Standard C/C++ and avoid compiler-specific functions that cannot be used with other compilers.

If you want a VB-like language that is cross-platform, look into Real Basic (http://realbasic.com/)

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

There is no function to do what you want. All you have is a string of characters. When you convert into a number, you'll know. Short of counting the characters and analyzing whether the characters are greater than "32767" or "65535", just convert into a long and don't worry about it.

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

As for syntax changes, I tried the Professional Version for some time, and the major irritation was that the use of functions like strncpy has been deprecated in favour of microsoft specific functions like strncpy_s. So you may get a lot of compiler warnings saying this and that is deprecated, blah blah blah. Of course you can turn if off with a specific preprocessor switch

Leave it to M$ to depricate standard functions in lieu of their own functions. Whether their reasoning is sound is immaterial. They should not ignore the standards because they don't like them.

I personally do not like this compiler specific code...

I despise this "compiler specific code" because of the arrogance. They can add the functions -- no problem there -- but to deprecate the Standard takes it too far.

but since I don't know the internals of the C/C++ standard implementations, I am not in a position to say where the old strncpy functions have gone wrong.

The problem with the string functions is they make it easy to overflow your string buffer. In some ways they are as dangerous as gets() and scanf("%s"...), but they are under control of the programmer, not the user. Any programmer worth his salt can handle this without difficulty.

Grunt commented: Nicely Said +1
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Hi. I can't a small part of this program to work correctly; the square root function either returns a bunch of funny symbols OR it returns 0.00

Split the statement into two. Print the value that goes into the sqrt() function to see it's value, then call the function. If you need to, break the huge statement into smaller and smaller pieces until you nail down the problem. And verify the values going into comp are valid.

1) If you have a structure nesting two other data structure types (like in my program where the structure contains an enumerated type as well as a union type) and you send this structure to a function, how do you write values directly into each of the fields via scanf?

First of all, I wouldn't.... ;) I don't like scanf.
But it looks like you're using it OK.

2) Did I use the scanf and switch statements for the enumerated types correctly? I think I may have gotten that part to work on accident -.-

Happy accident. If you print the values after reading them, you'll know for sure.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Open .txt file
Start a loop:
    read each line into a string
    if the line starts with "id="
        take the rest of the string and do what you need with it
End loop
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Firstly, I want it to be known clearly that you are NOT using Visual Basic.... the used the same name, but it's actually .NET or express, but not legacy VB.

I'm curious how you can tell with the information nedwards gave. I see nothing mentioning any version of anything...

I'm also curious why in a VB application someone would want to use VBScript? Why not just use VB?

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

Create the filename as a string value and use the string instead to open the file.