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

>>Reason: this forum owns! no.. no it doesn't
Huh?

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

socket tutorial and another one here

No matter what you do there is some basic amount of socket programming you will have to do.

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

you have to make the same change(s) in the class definition of the header file.

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

Just pass the entire struct

void LinkedList:: insertNodeAtStart(struct Hills& info){

Or you could pass the items individually

void LinkedList:: insertNodeAtStart(int hillsize, int gridref, int stance, bool climbed){
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

add this to the top of your program

#include <iostream>
using namespace std;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The next step is to write the implementation c++ code for each of the methods you have in that class. Here's a start:

#include "hills.h" // or whatever you named the file you posted

// constructor
LinkedList::LinkedList()
{
    // initialize the class variables
    head = 0;
    tail = 0;
    count = 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>please help!
Help do what? Write the rest of your assignment for you? The answer to that is a big NO.

We would need RandomUtils.h and ConsoleUtils.h too if someone wants to compile your code. But since this assignment is due TODAY I doubt you will get help quickly enough to do you any good.

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

I think that you need is this: The comments I made are things you need to do to complete the assignment.

const int size = 10; // or whatever number you want
int number[size] = {0}; // initialize all elements to 0
int key_value = 0;
// initialize all elements of the array with some numbers
// of your choice.

// ask and prompt for key_value so that you can
// type it from the keyboard

// create a loop to check each element of the array
// for key_value.

[edit]Didn't see Nick's post above [/edit]

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

Why don't you use c++ strings and vectors instead of re-inventing the wheel

#include <string>
#include <vector>
using std::string;
using std::vector;
// other using statements here

class str_pair
{
public:
     str_pair() { counter = 0; }

     str_pair(string ip, string uri)
     {
             this->uri = uri;
             this->ip = ip;
             counter = 0;
     }
     void setPair(string ip, string url)
     {
             this->uri = uri;
             this->ip = ip;
             counter = 0;

     }
public:
    string ip;
    string uri;
    int counter;
};

vector<str_pair> list_head;

int main(int argc, char* argv[])
{
    string_pair node;    
    node.setPair(argv[1],argv[2]);
    // add string_pair to the vector
    list_head.push_back(node);    
}

what are those pieces of code after line 35?

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

welcome to DaniWeb Chess. Hope you can help out around the Tech Talk boards.

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

Then redefine QUIT as 'q'

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

>>So I must chane [0] to [140][2]?

No. Just forget it. You have no clue what you are doing.

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

if QUIT is defined like this: #define QUIT 3 Then while( ( choice = MenuChoice() ) != 'QUIT' ) will not work. You have to make two changes
1) QUIT should be defined as '3'
2) The while loop should be changed as shown below

#define QUIT   '3'
<snip>
while( ( choice = MenuChoice() ) != QUIT )

>>But when I put 4 for QUIT
You entered the wrong value -- should be 3 not 4

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

line 48: The file is not opened. Move line 44 to after line 47. You can't open the file until after you know the value of the filename.

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

1) add include <string> near the top of the program

2)

void selectionSort (string array[], int size)
{
int start = 0, minIndex = 0;
string minValue;
for (start = 0; start < size - 1; start++)
{
minIndex = start;
minValue = array[start];
for (int index = start + 1; index < size; index++)
{
    if (array[index] < minValue)
    {
        minValue = array[index];
        minIndex = index;
    }
}
array[minIndex] = array[start];
array[start] = minValue;
}
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

We (I) don't really know who all those dead people are. Saddam was so insane that he killed anyone who disagreed with him.

One thing we do know -- there were no living AQ or other insurgents in Iraq until after Bush invaded Iraq.

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

how is 'QUIT' defined ? Your compiler should have generated an error on that line.

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

F:\508.cpp(35) : warning C4508: 'main' : function should return a value; 'void' return type assumed

add return 0; at the end of main()

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

>>Why no output is appear
Think about what you are doing. Look at lines 30 and 35. Can you guess the value of array[0] on the first iteration of that loop ? Hint: see line 19.

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

cannot convert std string to to char for argument 1 selection sort

you can not use strcpy() with std::string objects. Just use equality. Since array is an array of std::string's minValue must also be a std::string.

string minValue = array[0];
for (int index = start + 1; index < size; index++)
{
    if (array[index] < minValue) )
    {
        minValue = array[index];
        minIndex = index;
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 55: I see now -- just delete that line because line 54 does what you want it to do.

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

>>I would like to know if you can measure execution time in nanoseconds
No. milliseconds is probably the best you can achieve. If you are using MS-Windows you MIGHT be able to use QueryPerformanceFrequency()

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

try fgets()

char  menuchoice[2];
printf("please enter:");
fgets(menushoice, sizeof(menuchoice), stdin);
return menuchoice[0];
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Just change it like this to make 2d array?
NO NO.

int main()
{
    int array[140][2] = {0};
    ifstream myfile("filename.txt");
    int i = 0;
    while( myfile >> array[i][0] >> array[i][1] )
           i++;
    myfile.close();
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

post some of the errors.

On lines 55 and 57 you are trying to use an unidentified object inlab. Have no clue what that is supposed to be.

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

you should know by now how to open and read the file. All you have to do is make a 2d array of integers int array[255][2] = {0}; That will hold up to 255 rows of data

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

Are you STILL on that same program ? Is that the same problem you posted 185 posts ago ? Haven't you learned anything yet ?

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

compiles ok for me.

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

start here

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

what and where is the error?

line 88: can't do that. The function was declared to return a bool, not ifstream. But you could do something like this:

if( !(inp >> item >> cost >> quantity) )
        return false;
return true;

or this: return !(inp >> item >> cost >> quantity) ? false : true;

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

That should be calling members of the Triangle class which is not dependent on any given instance. So just remove Cool.

//Deciding which equations to use
int Triangle::CalcDecider(int choice1)
{
    switch(choice1)
    {
    case 1:
          Equilateral();
          break;
    case 2:
          Isosceles();
          break;
    case 3:
         Right();
         break;
    case 4:
         Obtuse();
         break;
    case 5:
         Acute();
         break;
    case 6:
         TriangleHelp();
         choice1 = TriangleType();
         break;
    default:
        std:cerr << "Invalid Choice. Try again\n" << endl;
        choice1 = TriangleType();
    }
}

Or, some people might code it like this, which is the same thing as above

//Deciding which equations to use
int Triangle::CalcDecider(int choice1)
{
    switch(choice1)
    {
    case 1:
          this->Equilateral();
          break;
    case 2:
          this->Isosceles();
          break;
    case 3:
         this->Right();
         break;
    case 4:
         this->Obtuse();
         break;
    case 5:
         this->Acute();
         break;
    case 6:
         this->TriangleHelp();
         choice1 = this->TriangleType();
         break;
    default:
        std:cerr << "Invalid Choice. Try again\n" << endl;
        choice1 = this->TriangleType();
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You poor boy :ooh: Changing color schemes will not help you with that. What will help is for you to turn your computer OFF occasionally and do something else.

People are BORN color blind. Read this. 20 years ago a lot of people developed eye problems because monitors radiated harmful rays -- I remember my eyes aching a lot after just a few minutes looking at the green monitors. That problem has been all but abolished in today's monitors.

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

>>what makes these two functions better to use over execl and execv?
Nothing. It just depends on how you want to use them. As described here execlp will search the PATH environment variable for the executable if path parameter does not contain a slash.

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

Dev-C++ is free. You get what you pay for. VC++ 2008 Express, also free, has a lot of options, including setting font and font colors. If you BUY the full version you can change the colors of all text and windows.But you will pay $400+ USD for that feature. Is that really worth the price just to be able to change colors ?

>>Certainly some may say this is a lot of fuss over nothing. But, I believe its really important

Important maybe only if you are color blind or unable to see black on white very well.

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

Instead of doing a direct link with the database why don't you write an SQL query in which you can filter the data any way you want then fill the combo box with the result set.
SELECT DISTINCT profile_name will remove duplicates

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

>>PrintString(*array);
That is not an array of strings like you originally declared because it only has one asterisk. All that takes is one character array. If you want it to print all the strings then you need it like this: printString(char **array); or this printString( char* array[]);

Sh13 commented: thanks for the help +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you join the US military at 18, you can retire at age 38 with a pension, college assistance and free healthcare. Not bad, since everyone else has to wait till they are 65+ for medicare and SS. Makes you wonder who the smart person is?

It may not be free any more. You can find all the info you need here.

Until I turned 65 last February we had to pay a co-fee for doctor's visits and 20% of hospital costs up to a maxmimum amount each year. Now, I don't pay anything even for medican because what medicare doesn't cover the military hospital benefints (TriCare For Life) will pay.

And there is no SS penalty for military retirement. So now I draw two government pensions -- military retirement pay as well as social security. Not bad for 23 years work in the US military.

It would be interesting to find out that other countries do for their military people.

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

You don't -- console programs do not have resources so its not possible to change an icon that doesn't exist.

CodeBoy101 commented: Very Helpful +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I've never heard of that kind of triangle. Are you sure it's a valid form?

You mean you have never heard of a four-sided triangle :twisted:

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

Read the Read Me links at the top of this c++ board. They contains lots of information.

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

Joining the military, even as a pencil pusher, will give you free lifetime healthcare.

Only is you stay in the military 20 or more years and retire with an honorable discharge. anything less get you zero.

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

IBM -- Its Better Manually.

hammerhead commented: good one +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you can get it with the Microsoft Platform SDK free from Microsoft.

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

Congratulations, you found the soldier in the Bush administration

Yup -- 1 for me and 0 for you :)

I guess. Unless you are completely clueless

I'm not -- I just like to act dumb sometimes.

Do you know what the civil service is?

Yes -- all of us who spent a lot of time on active duty know that. I'm not really as stupid as some people think you know.

Even Bush2 and Cheney admit there were no AQ in Iraq when they attacked

Yea, that's because Sadaam killed them all -- that's all those bodies in the mass graves our military people found all over Iraq. At least Sadaam knew how to deal with them.

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

Every MFC program has an object named theApp which is derived from CWinApp. Maybe that is what it is looking for ??? theApp is declared in <project name>.cpp near the top of the file.

You can also access it by calling the function AfxGetApp()

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

Lefties.

My son is left-handed so I guess that makes him a lefty. Everyone else in my family are righties.

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

COleVariant class encapsulates the VARIANT structure, which is nothing more than a union of a bunch of data types and pointers. The field vt is an integer that tells which of the field is represented by the union. Those data types are listed at the bottom of this page.

So to extract a float

COleVariant val;
float fl;
...
if( val.vt == VT_R4)
    fl = val.fltVal;

// similarily a string
CString str;
if(val.vt == VT_BSTR)
   str = val.bstrVal;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you can write your program with notepad but you can't compile it because notepad is not a compiler. If your school computers don't have a compiler then ask one of the teachers if they will download it for you.

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

I hate whiskeys and burbon. Give me vodka, gin, Kahula, and Irish Mist.

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

>>name one civilian in the Bush administration who served his country in the military
I'm certain there are lots of them. Afterall there are 1.8 million civil service employees not counting postal service. That has to include thousands of prior military people.

Secretary of State: Colin Powell -- retired General.

Of the others found here, you'll have to research them yourself.