thomas_naveen 105 Junior Poster

You are passing by value. Try passing by reference.

thomas_naveen 105 Junior Poster

nested switch?

thomas_naveen 105 Junior Poster

Kindly let us know whether your issue is resolved?

If so, mark the thread as solved.

thomas_naveen 105 Junior Poster

Think about the flow.

How was the goto working?

Does the while loop take the flow the same way?

You need the flow to reach back to the cin.

For that you need to include the cin also in the loop.

thomas_naveen 105 Junior Poster

You are getting these linker errors, since the constructors given in the error cannot be found by the linker.

Try implementing them.

Credit(int, double, double, string);
Saving(int, double, double);
Checking(int, double, double, int);
thomas_naveen 105 Junior Poster

Memory should be allocated before you use the pointer for storing data.

In the current code you are taking in data to a pointer which could be pointing anywhere and then pointing that pointer to a fresh memory location.

You lose the input data in this way.

Make the 7th line your 5th line and check out the results.

thomas_naveen 105 Junior Poster
int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};

Try with the above modified days array.

thomas_naveen 105 Junior Poster
void move_left();
void move_mid();
void move_right();

Put the three lines at the top of the file or in a header file, move.h

and say

#include "move.h"

at the top of the file

I am assuming that move_right is aslo visible for compilation.

thomas_naveen 105 Junior Poster

You need to define the functions at the top of the file
or

in a header file and then include the header file.

thomas_naveen 105 Junior Poster

If it is a csv file, I believe you can read it just like a text file.

thomas_naveen 105 Junior Poster

Try allocating memory to your dir variable. Similar to the command variable.

thomas_naveen 105 Junior Poster

28-31

void setY(int n)
           {            
                    x = n;
           }

This should be

void setY(int n)
           {            
                    y = n;
           }

Please check for more errors.

thomas_naveen 105 Junior Poster

fmaxf for floats.

thomas_naveen 105 Junior Poster

fmax takes only two variables as input.

So you can only use fmax(a,b)

For three variables a,b,c
use something like

d = fmax(a,b);

e = fmax(c,d)

e will be the max of a,b,c

thomas_naveen 105 Junior Poster

You are expecting smallResult to be populated by the sumOdd function without calling the function.

For the code in sumOdd to be executed , you need to call the sumOdd function from the main function.

thomas_naveen 105 Junior Poster

Better check out line 98 as well. It looks very similar to the bug you have identified.

Salem commented: It's the catch of the day :) +19
thomas_naveen 105 Junior Poster

Take alook at the strcpy function.

The C string will have a terminating null character.

In the for loop,

for (indexer = 0;others[indexer];indexer++)

when the index (indexer) reaches the index of this terminating null character , the loop will exit.

Please use the CODE tags properly.

thomas_naveen 105 Junior Poster

double stands for double precision floating point number in C++

thomas_naveen 105 Junior Poster

You have followed some thinking process to arrive at the answer, right?

Now convert this into pseudo code and finally code.

If you post atleast the pseudo code here, you will get some help.

thomas_naveen 105 Junior Poster

Have you set the path variable?

You can debug build by setting the verbosity.

Check your compiler documentation.

thomas_naveen 105 Junior Poster

You need to forward declare the Checking class.

thomas_naveen 105 Junior Poster

Can you clearly and concisely state your problem?

thomas_naveen 105 Junior Poster

Try setting the path too.

thomas_naveen 105 Junior Poster

Check the size of the library on disk and whether you have the necessary permissions to use it?

thomas_naveen 105 Junior Poster

You could consider strtok instead of sscanf.

I hope the large sized arrays are justified. You could end up corrupting your stack.

thomas_naveen 105 Junior Poster

This works out to a negative overtime , right?

Try giving a hourly pay of 50.

thomas_naveen 105 Junior Poster

I have seen this problem before of large arrays on stack.

Just declare it as a global.

halluc1nati0n commented: I didn't even think of the stack! +1
thomas_naveen 105 Junior Poster

Didn't you see the first reply to your post?

asctime returns a character pointer.

The currentTime function returns a character.

There is a mismatch here that needs to be fixed or taken into consideration.

thomas_naveen 105 Junior Poster

Code & calculation looks fine.

NOTE: uniondue should be defined as a static const. (optional)

If deduction is greater than hours * rate, your overtime will be negative.

Can you post your inputs?

thomas_naveen 105 Junior Poster

Please post your code.

thomas_naveen 105 Junior Poster

Check out this tutorial.

I have no idea about any books on the subject.

However, several books have been listed in the reference section of the given tutorial

thomas_naveen 105 Junior Poster

No. You will be calling seeding only after you have finished processing all your input parameters from command line.

Line 38 is outside the for loop where you are processing your command line parameters.

thomas_naveen 105 Junior Poster

Please take a look at how the c_str function is used.

thomas_naveen 105 Junior Poster

What I meant was:

comment out seeding() on line 27.

Add the following on line 38

if(count)
{
       seeding();

}
thomas_naveen 105 Junior Poster

You can call the function immediately before you call cleanup either by itself or after checking for count.

thomas_naveen 105 Junior Poster

Welcome to the club!!

However, it is fairly easy to identify SEG faults once you can competently use a debugger. Compile with -g option to use binary with debugger.

There are some cases where even the debugger can't help you.

Thorough analysis of the code only can help you there.

Ancient Dragon commented: Yes. +26
thomas_naveen 105 Junior Poster

You are having a problem in line 32-36.

Instead of iterating through the linked list and adding your element at the end, you are pointing your head node to the new node and the new node points to your head.

All the intermediate nodes are lost. You are left with a LL of two nodes.

thomas_naveen 105 Junior Poster

My apologies. I was looking at the original post. I believe you have got it right in the post after AD's post.

thomas_naveen 105 Junior Poster

Are you allocating memory to Index?

I can see "Index[Counter] = new"

But I don't see "Index = new" anywhere or it's equivalent.

thomas_naveen 105 Junior Poster

I would like to see Event.h

Can you please upload the same?

Also, posting in bits and pieces of code is most irritating.

You are posting it because you don't know what the error is. Then how do you expect yourself to understand what part of code is causing the problem. Just because the compiler is pointing to one line doesn't make that line the culprit.

thomas_naveen 105 Junior Poster

Issue is with your while loop. It was not exiting properly.

Change

while(!myFile.eof())

to

while(getline(myFile,line))

and comment out the getline inside the while loop. (no need for two getline function calls)

thomas_naveen 105 Junior Poster

Spelling mistake at 64

Employee::Employee()

70,71

firstName = first;

lastName = last;

You are assigning a character to a character pointer.

An approach would be to change this to take char pointers as input and use a string function to copy.

Allocate memory for the pointers in the constructor.


74-77 variable is mis-spelt. Declaration of functions in Employee.h and Employee.cpp don't match.

Before calling this function make sure that memory is allocated to the firstName pointer.

Employee:: setfirstName (char *fisrt)// should be first
#
{
#
strcpy_s ( firstName, first);
#

Continue like this and get back with corrected code.

thomas_naveen 105 Junior Poster

Change the getmax implementation as

template <class T>
T pair<T>::getmax (){

In main use

pair<int> myobject(100,75);

Also rename pair as pair1, as there is a naming conflict in std namespace. (else remove using and use std:: as required)

thomas_naveen 105 Junior Poster

you can use a function like

float calcPyramid(int length,int height)
thomas_naveen 105 Junior Poster

First of all you are passing radius to calcPrism and calcPyramid.

In those functions, the calculation is not based on radius.

The compiler fails to give any error , because you have the length,height and width defined as globals.

thomas_naveen 105 Junior Poster

Try using a debugger like gdb to identify the exact crash and the reason.

thomas_naveen 105 Junior Poster

Take a look here.

thomas_naveen 105 Junior Poster

Good catch WaltP.

@mrinal.s2008

Please check up the usage of ostream_iterator's * and ++ operators and how to add elements.

thomas_naveen 105 Junior Poster

Check whether your stream is open using is_open().
Use eos as the exit criteria for the istream_iterator.

thomas_naveen 105 Junior Poster

I wanted to check whether there is a naming conflict since the code has

using namespace std;

It could be something specific to the version that is being used.