~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey, no ones takes away the title of *having no life* from Joey !... :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

XML, C, Java, VB.... ;)

Girl, you sure are messing up pretty bad. At first concentrate on a single thing otherwise would end up being a jack of some trades and master of none. Too many languages will only confuse you.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Simply said, in pass by value, a copy of the value of the variable is paseed to the function while the original variable remains unchanged.

void doubleValue (int i)
{
    i = i * 2;
    printf ("\ni inside function is %d", i);
}

int main (void)
{
    int i = 9;
    printf ("\ni before function call is %d", i);
    doubleValue (i);
    printf ("\ni after function call  is %d",i);    

    getchar ();
    return 0;
}

Run the above code and you would understand the function has its own copy of the variable "i". I used the same variables so that you would know they are not the same.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Use [search]strcpy[/search] to copy the contents of the string pointed by ch to another string.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Aia and OP, try this... ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

#define PI = 3.14159265 This statement is wrong. Preprocessor statements are not written this way. The correct way would be: #define PI 3.142 or better yet const double PI = 3.142

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

and you would

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

sit

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Indian medicine - effective

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

the mad scientists

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Earth mother provides us with all the goodness it takes to live a happy life.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

March in to the sea - Modest Mouse

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

*Ahem*... ;-)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey there Kim, welcome to Daniweb :D

And as far as grabbing attention is concerned, you can always attach your photo with every post and be rest assured that your photo...err I mean your post will always be read... ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Coding the tutorial with the magic number given to ignore function would not be such a good idea.

Either declare the constant at the start of the program, in a header file or better yet use inbuilt constants like max value provided in the limits header file.

Another robust method for accepting a integer worth incorporating in your tutorial is:

int main()
{
    int x;
    char ch;
    std::string myString;
    while (getline ( cin, myString ))
    {
        std::istringstream strin(myString);
        strin >> x;
        if (!strin)
            cout << "Bad input" << endl;
        else if ( strin >> ch )
            cout << "Bad input" << endl;
        else
            cout << "You entered: " << x << endl;
    }
    getchar ();
    return 0;
}

Hope, it made sense, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Since nothing spectacular is involved here, there is no question of time and space complexity. What we are facing here are bad design issues.

  • Make the member variables of a class as private and always make it a habit to write mutators and accessors for them (get and set methods).
  • Stay away from hardcoding values into the class. Let the driver class or the test class handle such things for you.
  • The employee class needs to be abstract since you can't as such create an instance of an employee or it rather doesn't make sense. The employee in your organization would be either a clerk, salesman or manager but never just an employee.
  • Providing constructors for the classes you write is a good practice.
  • Avoid printing in get or set methods. Print out the values of variables in the driver or main class.
  • The show net salary is also better off as an abstarct fucntion in the employee class which has to be compulsorily overridden.

There can be many other minor glitches, but the above ones leap to the eye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You are better off dumping gets which will save you a lot of trouble in the future.

Look into functions like strstr to ease your task.

Oh, and btw, main returns in int.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

A good start would be this...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Or something like this:

if (isspace (*p))
{
    cout << "The character is a space character";
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

By selective processing I meant, split or process the string in such a way that it can be used for initializing the members or loading the class data.

Eg.
Extracted string:
artist, track, time

Processed Output:
artist -> store in artist name
track -> store in track name
time -> store in track length

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey there Joey, congratulations on your achievement and the prizes. :D

I now believe that the prize thing was for real and not a hoax... ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hello my friend, welcome to Daniweb :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey there my friend, welcome to Daniweb :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey, but still

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Oh, I believe processing cycles should be saved whenever possible.

Consider the input: 4384023824039483043840aadf348304923840394sdffdfd8304382409243464565204 Might seem a bit nonsense, but still happens. Or worse, if this function is applied to each and every line of the data file which is full of numerals. It helps me in saving or not performing the redundant computations (that would be 5 comparisions in worst case) whenever possible at little or no extra cost.

But then again, a matter of perspective and style.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

a bad memory.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Also, if you forget to include the break statement after any case and that evaluates true, the following case will be executed too.

Oh, that would be all the cases after that, not just the following case.

Here is an interesting code snippet:

int main ()
{
    int ch = 66;

    switch (ch)
    {
        case 1:
            cout << "In one" << endl;
            break;
        case 2:
            cout << "In two" << endl;
            break;
        case 3:
            cout << "in three" << endl;
            break;
        default:
            cout << "in default" << endl;
        case 4:
            cout << "In four" << endl;
        case 5:
            cout << "in Five" << endl;
    }
    getchar ();
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Alive - Payable on Death

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

medicine - ayurveda

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Feet and inches, kilos and pounds, save the world, its going down down down.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

stark

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get Mrs RwCC.

I put in a twisted transistor.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
MP3::MP3(char * newartiste, char * newsongtitle, int newtracklength)
    {
    artiste = newartiste;
    tracklength = newtracklength;
    songtitle = newsongtitle;
    }

The above code is a disaster piece. First thing, all you are doing is assigning the reference or the address of the C string passed in the function to the member variables of your object. Thus effectively, both your local function variables and object variables point to the same location, which is incorrect. Trying to free these variables adds another feather in the hat. Also you can't assign values to C style variables using assignment operators. You have got to use strcpy. Use variables of the string class to hold the song and artist name since you would be spared of the trouble of allocating and deallocating memory.

And as far as the issue of reading from the file is concerned, you can write values to the file in the CSV (comma seperated values) format. Artist name, Song name, Track Length While reading, read the entire string in a string variable and do selective processing which best suits your application needs.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Something like this should make your professor happy:

for (int i = 0; i < length; ++i)
    {
        ch = tolower (line [i]);
        if (isalpha (ch) &&
             (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u'))
        {
            ++vowelCount;
        }
    }
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Why restrict the user by asking him to enter a "period" after the sentence ? Replace your while loop with a for loop, something like this:

int length = str.length ();
for (int i = 0; i < length; ++i)
{
    // do processing
}

Accept the whole sentence from the user in the form of a string and pass the string to this function, which will loop through each character and find the vowel count.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You go in trance.

I put in some beads.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

It really is a beautiful sight, ah..the setting sun.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

my chest is

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Immense towers of France commence malodorous INHABITANTS while becoming famous monuments.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

pain and sorrow

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Image processing is an interesting field in computer science.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

sportsman

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get a bee's hive.

I put in my keyboard.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The sheer pressure

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Streakhouse - Doctor House

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Down with racism.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Gutterflower - Goo Goo Dolls

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Would it be easier to remove duplicates if the vector was sorted first?

Definately. It would then require only a single loop to do away with the duplicates.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Sometimes life is altered. Things don't turn out right.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

spurt