Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Wow, Demi Moore is OLD

Not old, just getting seasoned. But she's still hot.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Ok I added the line numbers for you, which compiler are you using and what line number is it complaining about ? Probably line 6 as Salem mentioned?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

google for quick sort and you will get your answer. But the easiest to code is standard qsort() method.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>yes, How can i get C++ to read a character from a string??

After reading a line from the file you will want to create a loop that checks each character in the line for the character that you entered at the keyboard. std::string has a couple methods size and length that tell you how many characters are in the string so your loop counter should run from 0 up to but not including that number. Then just use the loop counter to index into the string just as you would any other ordinary array like this: if ( word[i] == c) >>trivial?? haha now i feel like shet
Just because its trivial doesn't make it easy. Hammering a nail into a board is trivial to a carpenter, but I can't do it easily.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 25 and 26 should be combined like this while( infile >> a_word )

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you can reduce that to just one line like this: double qtrsSales[NUM_QTRS] = {0.0}; That will initialize all elments of the array to 0.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Does that mean the US can keep Iraq?

Probably -- but we don't want it. Besides, it wan't really a fair fight -- I don't call a playground bully beating up on a whip a fair fight either. In this case we were the bully and Sadaam was the wimp.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I assume you are not allowed to use standard C functions such as atoi() ? If you have to do your own thing then just subtract '0' from the digit and add the result to an int accumulator. For the second digit multiply the accumulator by 10 and repeat the above process. Put all that in a loop and you can do as many digits as there are in the string, but you have to be careful of data overflow (converting more digits then the int accumulator can hold -- see limits.h for max possible value for your compiler and os).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It Depends On The Operating System. (Please stop capatilizing every word -- its really really annoying.)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

a char is nothing more than a small one-byte integer. To convert a char to an int use the assignment

char c = 'A';
int n = c;

Or if all you want to do is print the int value of the char, just typecast it

char c = 'A';
cout << (int)c;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

in america a democrat is a political party, not a type of government. And No, the USA is not a democracy but is a republic. There are no true democracies anywhere in the world. A republican is also a political party. The terms liberal and conservative are also used to mean democrats and republications -- why I have no idea, its a little confusing to many of us too.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The problem isn't the boy -- he's not old enough to give consentual sex. But the teacher will probably spend several years behind bars, spend the rest of her life on the sexual offense roster, and her teaching career is over. She runed her life for a few minutes of pleasure.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I've read that most bottled water is tap water.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can forget MFC because the Express version doesn't support it. You need the Standard or better version for that which costs $$$. It will support standard win32 api if you download the Windows SDK and following the setup instructions carefully -- its a pain in the a** but works if done correctly. It also supports CLR -- how much I don't know.

Here is a tutorial for win32 api programs that will get you started. You are expected to have basic knowledge of C or C++, but no C++ OOP is used.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

n is not changed so use const int & in lieu of int &

why? just don't pass it as a reference and it won't get changed. But Nurue's solution is the best (assuming the calling function doesn't mind having the integer changed on it).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

OMG why in the world are you doing that just to extract the name part of the string! If the CString already contains the full path + filename just use its Find() method to locate the last '\' and you have the name starting with the next character.

>>That mean I have to cast CString to a char buffer, is that right? Is it possible?
Depends -- is your program compiled for UNICODE or not. If it is, then CString can not be simply typecase, it must be converted from wchar_t* to char* with one of the conversion functions.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Make it a pointer instead of a reference.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

using c++ std::string object use the find method to locate the ':' and then the substr method to extract all the characters from position 0 up to but not including the colon.

I'm not going to write it for you, so post the code you have done.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes I've thought about that a little too. We could also be inside someone's test tube, just as we have a test tube with water that is filled with bacteria.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Reads are normally done in another thread so that it can block while waiting for incoming data. If you don't do that then your program is highly likely to miss data. Follow the links in MSDN for CreateFile() and it will tell you how to read/write serial communications.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Contrary to popular belief living humans can not communicate with the dead, either now or sometime in the future. There is no such thing as a ghost. Why? Probably because Heaven does not contain people in human form. After I'm dead I'll try to post something here to let you all know more about it :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The assignment is due Tuesday Nov 8! I hate to inform you but Nov 8 is tomarrow, Thursday. In any event, you are just now starting that assignment ???

Do the program one small step at a time, and compile frequently so that you don't get overwhelmed with errors.

First step is to design the file format. From the looks of that structure each record needs to have the phone, address and name. Since address and/or name can contain spaces I'd suggest surrounding them in the file with quotes or separating them with a comma. The '\n' will be used to separate records.

Next you will need two functions -- one to read a line and save the contents in the structure, probably mygetline() can do that. The other function is to write out the data to the file.

When you get that done, post your results and we'll help with the rest, if you need it. But unfortunately for you I doubt you can complete this assignment by 9:00 am tomarrow morning, which is only 15 hours away in my time zone.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 6 is wrong scanf("%d", &s.age[i]); And the sort algorithm needs some twinking. line 34: Its not necessary to check from 0 to current value of j because they are already in order. for(i=i+1;i<5;i++) And the swaps should use j and i, not i and i+1.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

it seg faluts probably because it doesn't compile. You can't declare an array like you did in main(). You have to allocate it dynamically, like this:

int main()
{
    int n;
    int* array = 0;
 cout<<"Input the array size you want"<<endl;
cin>>n;
   // allocate array size
   array = new int[n];

}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The idea was, could Chaney, sorry Cheney, and his pupil use some excuse like a major expansion of the endless war to stay in power and establish a more military based "democracy" along the line of Pakistan?

No, that is not possible, so don't worry about it. There will be an election in US next year and in Jan 09 we will have a new President and VP. There is nothing short of full nuclear war where we are blown to bits that can prevent it. And in that case, who the hell cares?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

But infinity cant exist if physicists believe that there is a finite amount of enery in time and space

That doesn't mean it doesn't exist, afterall physicists believed the earth was flat at one time too. Take space for instance -- there is no end to it, just goes on forever. If there is an end to space then what's on the other side?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

And your proof? You might be right but nobody knows if infinity even exists let alone what it is. But that's a topic for a different thread.

touché :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

and u must be polite with ur guests !!!!!

Absolutely agree. And most of the time we are.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If the program knows the last number used, such as "06/11/07_1", then extract the digits beyond the underline, convert to int, increment the int, then reformat the number.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>but the problem is that same result is printed for any number
The scanf() line needs a pointer to n.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I could hear up to 20K but a few lower I couldn't hear such as 13K and 16K.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I DIDNT ASK FOR UR OPINION !!!!!!!

You're going to get it sometimes whether you like it or not. So get over it. We're all one big happy family here and do not like people with a lousy or smart-mouthed attitude. You are most welcomed to join in if you drop your greater-than-thou attitude.

I wasn't trying to be rude -- just asking you not to use abbreviations like that here because most people won't know what they are.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

VC++ has excellent debugging capabilities. A little difficult to learn but because its so loaded with features. You can download a free version VC++ 2005 Express that is identiacal to the commercial version minus some features such as mfc support. But you can test-drive the compiler and debugger.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You have to create a new account.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

DYNCALL is a macro that is expanded by your compiler. You will have to look in some *.h file where that macro is defined if you want to know exactly what it does.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>but the Write uses char arrays that I can't get my teeth around.

you can use win32 api functions to do that -- open the serial port with CreateFile(), then use WriteFile() to write the data and ReadFile() to read it just as you would any normal file on your computer. There are a whole bunch of other functions to configure the serial port and wait for incoming data. See links in MSDN under CreateFile for more detailed information about this.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>also i am using GUI
You mean the compiler is has a GUI interface ? I think you will probably have to use the curses library.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

To simplify your code you should probably write a function that returns the minimum value of the array that you pass it. Then you can pass it each of the arrays and print out the min for each. You only have to write the algorithm once instead of 6 times.

int min(int array[], int size)
{
   // your code here

}

int main()
{
    int A[7], ...

    cout << "min of array A is " << min(A,7) << "\n";
    cout << "min of array B is " << min(B,7) << "\n";
    ... // etc. etc.
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

2 is an integer, 2.0 is a double, 2.0F is a float

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Since X is never used anywhere else in your program you can remove it like I posted. Its up to you whether you want to use static cast or not. In some cases you might have to, but for literals you can just add .0 to the end, such as 2.0 instead of just 2. A[i]=( 2+pow( static_cast<double>(i), 2.0 ));

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes I see now its initialized on line 19. But still, why do you need that array. You can just simply do this:

for(i=1;i<7;i++)
{
       A[i]=(2+pow(i, 2.0);
       B[i]=(1+pow(i,3.0);
       C[i]=(2+pow(i,1.0);
       D[i]=(3*pow(i,3.0);
       E[i]=(1+pow(I,2.0);
       F[i]=(3+pow(I,2.0);
}

Also not that line 6 appears to be wrong -- using * instead of + like the other lines

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What is the purpose of X array?
the pupose is to get the value.

To get the value of what? All elements of that array are initialized to 0 and you never change them.


I have compile bit for the initial solution, why is it 0?

See above.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yeah, I've actually never really been to a concert.

Good -- a lot of young people loose their hearing (and probably other things too) in such places because of all the excessively loud noise. You can also ruine your hearing if you play lots of computer games while wearing head phones.

>>You are a dog
The author is jealous :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

did you compile that? Probably not because it has lots of errors. Start out by counting the open and close braced and make sure they match correctly. Next fix the indention -- its absolutely horrible. Don't be afraid to use the space bar to align the braces and code.

lines 18-23. What is the purpose of X array? Why do you even need it? Did you read what I previously posted about it? Obviously not because you didn't change it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There were only two that I couldn't hear.

Hearing test results
You aren't even a teenager yet!
Your hearing rules! You're either quite young or you've looked after your ears.

If you can't hear as much as me than either (1) you need a new soundcard in your computer or (2) you need to stop going to those rock concerts or turn the radio down in your car.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I heard them all up to D# (age: old fart)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

when you start to download something you should get a prompt for where you want to store it. The motherboard has nothing to do with this.

>>Is there a way to transfer and also save all software downloads primarily to my C drive?
Yes -- its called drag & drop. In Windows Exploror highlight the files you want to move then drag the cursor to the destination folder and let go of the mouse button.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>How to use code tags?
Look in the edit box. The instructions are in grey letters. All you have to do is read them.

>>whata is complier?
Too bad I can't issue an infraction for being such a dumbass. :) But I hope you were just teasing.

lines 20-25 of your original post: array x is initialized by the program's start-up code to be 0 because the array is in global memory. So 0 ^ <any number here> is always 0.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

“In a word, it’s nationalism, and nationalism is very, very scary. It pro motes segregation and racism. That’s what this bill does. It promotes racism and segregation. It’s very scary that this is what Oklahoma wants.”

What a lot of crock.

During debate, Sen. Judy Eason McIntyre, D-Tulsa, called the bill mean-spirited and a sham.

It imposes costly and ineffective mandates on state and local agencies and and theatens access to key public services, she said

You better bet your boots it does! And its about time too. Is it "mean spirited" to protect one's home from an invador? If someone illegally moves into my home should I be expected to pay for their medical expenses ? Hell no!

joshSCH commented: I'm glad we are in agreement for once ;-) +12