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

Flights is a three-dimensional array because it has three stars. If what you really want is a 2d array then remove one of the asterisks in its declaration.

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

Oh gee Ancient, you used the F word! Watch your manners, old man!

Depends on how you want to interpret "f***". It could mean any of several hundred words that begin with the letter f.

What does that all have to do with Illegal Immigration (the title of this thread)?

Absolutely nothing. :)

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

See index values shown in RED. You should have used k instead of i and j.

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

>>How would I go about completing this task?
Did you try to compile the program? If you did, what errors did the compiler produce? If you did not compile it, why not? Hint: lines 7, 13 and 14 are wrong.

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

volts[MAXNUMS] is the name of an array
volts = 0 is the name of a simple integer

They must have different names

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

you are attempting to duplicate the symbol name of the array and a variable. Variable names can not be duplicated.

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

>>I need some help writing this program
Which part are you confused about? We are not going to write the program for you. So you might as well do what you can, post your program, and ask specific questions. The instructions seem to be pretty clear to me.

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

closed

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

closed

Jishnu commented: Thank you for banning that guy. +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Jishnu: Instead of hijacking this thread you should have used the Flag Bad Post button.

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

If by "divide the array" you mean split each line up into its individual parts, then Yes that can be easily done. The c++ stringstream class will help do that. This will NOT work if there are no spaces after the commas.

#include <sstream>
#include <string>
#include <iostream>

int main()
{
     string line = "123, Cathy, Ryan, 1 99 2 88 3 77 4 66 5 11 6 44 7 33 0";
     string word;
     stringstream stream(line);
     while(stream >> word)
     {
         // got a word from the line.  Now do something with it.
     }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

moved to c++ board.

>>please tell me how to become a member of this tag???
Huh? Have no idea what you want.

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

You can correct the problem like this: if ( flag == 0 && (s[i] == '+' || s[i] == '-' ))

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

you need to validate the value of arr_siz entered on line 26. What happens to your program if I enter 1000 on that line? Or if I enter a negative value ? Your program will die a very quick and ugly death.

>>it must work as well on Maximum also can anyone add that codes
Looks to me like it already does that.

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

line 18 doesn't work anyway. you can't assign c-style arrays like that, but use strcpy() to do it. Do it like Salem suggested and you can just simply delete lines 17 and 18.

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

1. functions can not return arrays like you are trying to do. A better solution is to pass a pointer to the array as a parameter so that the function can populate it, like this: void LongLongToString(long long num, char* string) 2. The entire algorighm for that function is just flat wrong. It can't work. Why? the value of num is 0 by the time line 22 is reached. What you want to do is make a copy of num so that its value can be restore before executing line 22. Another reason that algorithm is wrong is that line 24 will not insert the ascii character of the digit but rather the binary value, which is not what you want. You need to use the mod operator, not the division operator, and add '0' to the calculation string[counter-1] = (num %10) + '0';

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

You said: >>Or is any better way to do it than array>
I answered that question.

>>Do you think in something else please ?
Replace the vector with linked list or replace it with a c-style array of those structures

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

I just want some help.

Learn to crawl before you can walk. You have to learn the language before you can even think about undertaking such as huge project. The people who wrote those program have years and years of experience. You will only fail miserably if you try to copy it now.

Salem commented: Sound advice indeed. +13
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think I would use a vector of structures. You need two structures

struct numbers
{
    int saleNumber;
    float amount;
};

struct person
{
    int ID;
    string lastName;
    string firstName;
    vector<numbers> numberList;
};

Now just make a vector of the above person structor, e.g. vector<person> personList

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

American is a tough accent to copy well, there are many ways to do it, but they all sound rubbish :D

There is no one American accent just as there is no one British accent. I had a tough time when I first went to UK (RAF Mildenhall) in the early 70s getting accostomed to the accent. At first you all in UK might as well have been speaking Chinese.

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

how come we dont eat turkey in the UK apart from on christmnas then?

Don't know, but we eat turke year-around. Not every day or as often as chicken, but its popular all the time. And its healthy too, much better you than artery-cloging fish & chips or hamburgers & fries

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

for cross-patform GTK is a popular choice.

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

We stole it from UK. The early white settlers brought that tridition with them and we just adopted it as a national holiday.

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

turkey with dressing, gravy, sweet potatoes, cranberry sauce, roles, Jello salad, pumpkin pie with Kool Whip. I will probably gain a million pounds today :)

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

I think these are the kind of threads that need to be closed.

agree

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

If you enter prime 7 as the command-line argument then the word prime will be in argv[1] and '7' is in argv[2], making argc == 3, not 2. argv[0] is almost always the name of the executable program.

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

why don't you ask these people ?

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

read the articles at www.codeproject.com Enter CHTMLView in their search engine and you will get a list of several articles that explain how to use that MFC class.

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

If I comment out lines 49-52 because you didn't post those functions your program works ok for me.

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

the const keyword tells the compiler that the variable will never ever be changed. Since you expect to enter value for user_height then it cannot be declared const. Same with the other variables.

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

you don't program the ports directly but use the installed device drivers. Most common method is to use sockets.

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

How about disallowing posing live links unless poster has got 20 posts .

That might create more problems than it would solve. There are some places on DaniWeb where posting links to one's own site and advertising is permitted.

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

They still are at the top when I look at them using IE7 on Vista.

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

Yes mixing spaces and tabs creates a big mess out of code which is one reason to set the option on the IDE to replace tabs with spaces. I wouldn't worry about the code you posted yesterday. You can always repost if you have made changes that you want to discuss.

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

>>The idea is to send someone else on a course, who can then bring me up to speed
That won't happen. There's a lot more to writing c++ than what can be stuffed into one course. And taking one course does not a teacher make. My suggestion -- take the course yourself and learn from someone who has been programming in the language for several years and is an experienced teacher. Even if you have to take night classes on your own time, and hopefully your company will pay the tuition/fees/books.

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

you have about 30 minutes to edit a post.

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

>>so the size of the executable may well be a consideration.
The size of the executables is not relevent as long as you make sure the computers have sufficient RAM and hard drive space. If the programs are having memory problems then its probably due to some faulty programming, not the size of the *.exe files.

My first thought is if it ain't broke don't fix it. But if you are going to do a major overhaul then I think I'd go for c++.

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

That was funny :) :) The guy with the lighter could have gotten some very serious burns with that dumb trick.

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

I didn't take that test because no point in me doing that -- I get lost driving around the block :)

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

hello guys
could you help me with this problem?
well you just need to use an array.
Write a C program that accepts name,address,age,midterm,&final. then compute for the final rating. Use an array that allows the user to input as many as they want. Your code must display all inputs & all the result of the computation.

Thanks
for
Reading

Ok, I got it done now. I'll send it to you after you put $15,000.00 USD into my paypal account.

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

Guys...stop being so harsh on him...here is the answer:

#include <string>
#include <cmath>

using namespace std;

int main()

{
cout<<"Press x to get the answer"<<endl;
cin>>x;

After you complete this, the answer will automatically be emailed to your professor...no sweat...we're always here to help.

That's c++, not C, so it's completly unusable to the OP, but then again maybe that was your intention :)

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

Sure. That works.

Does it? push_back only makes a copy of the pointer, the memory is still allocated to the original pointer which is deleted immediately after the push_back. Now list has an invalid pointer and any attempt to dereference it will fail.

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

WTF. the US screwed up new orleans bigtime

No, the US did not screw it up -- the people themselves f**cked up by building houses below sea level then wonder why the sea flooded over them. We may be the most powerful nation on earth but we still can't control the weather. New Orleans was a disaster waiting to happen for many years.

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

line 12: should be this: while(p) Your program gets segment violation when strtok() returns NULL.

>>I realize its probably overkill for my purpose so if anyone could point me to a simpler solution that would be appreciated too.
In C language that's about the best anyone can do.

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

The default copy constructor does only minimal thigs -- it is not sufficnet for most classes that contain objects of complex types such as pointers and container classes.

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

He probably figures that it's better than "Hey nerds, do my homework".

I like that title better than the original because its more meaningful

Salem commented: Now that's entertainment! +13
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what have you tried? The logical query would be where a = condition1 and b = condition2 and e <= something but since we don't know what condition1 and condition2 are we can't give much more help. So post your actual code if you want better help.

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

line 22: you have to give the parameter a variable name. int F(int &n)

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

you could try to rename it, if it failes then its probably in use.

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

You might check with Sybase to see if you can get a version of the library in the language of your choice. They also have free online support forums where you might ask your question.