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

What is the problem ?

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

Come on, AD - give it up! We want a hint - I think the standard is book - chapter - line(s) (zeke 12: 13-69).

I'm not turning this thread into a religious discussion. Read the new testiment yourself if you really want to know.

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

National health care for everyone will cost you Trillions. Thankfully I'm pretty much out of the job market now, but you all are going to be paying through the nose for that. The result will be either 1) skyrocking taxes or 2) reduced medical care for everyone. If you think medicare fraud is bad, just want and see what national health care will get you.

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

End result: glassy-eyed supermarket cashiers who can't even add up.

LOL: Not where I work -- we have to pass a first grade level math test before we can be hired as a cashier :)

Yes, I remember hearing about those experimental schools -- they didn't last long.

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

Scooby, Road Runner, the Jetsons, Underdog, were and still are my favorites. Yes, even at my ags, I still watch cartoons occasionally :)

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

delete main() out of stack.cpp and everything links ok for me. Using VC++ 2008 Express.
Do you have stack.cpp part of our compiler's project ?

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

>>reply plz plz in two days i have to submit it in 4days
That is your problem, not ours. How long have you had that assignment ? What are the requirements ? "A budget for an office" could mean almost anything.

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

This is what I get on Vista. How is it different that yours ? How do you want it to display?

Enter last name: aaa
Enter first name: bbb
Enter id: 100
Enter score: 100
Enter last name: ccc
Enter first name: ddd
Enter id: 200
Enter score: 200
Enter last name: eee
Enter first name: fff
Enter id: 300
Enter score: 300
Enter last name: ggg
Enter first name: hhh
Enter id: 400
Enter score: 400
Enter last name: jjj
Enter first name: kkk
Enter id: 500
Enter score: 500
                                                         aaa
                                     bbb
                 100                                                         100

                                                         ccc
                                     ddd
                 200                                                         200

                                                         eee
                                     fff
                 300                                                         300

                                                         ggg
                                     hhh
                 400                                                         400

                                                         jjj
                                     kkk
                 500                                                         500

Press any key to continue . . .
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>detailsPtr head;
That is an uninitialized pointer. Set it like this and everything should work. detailsPtr head = NULL;

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

I don't know. you might google for them.

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

Read the tutorial I posted and you will understand. It's a lot more complicated than VB. If you are going to write a c++ program then you absolutely must understand file i/o. Forget what you nearned from VB, C++ is completly different.

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

You are absolutely right -- here is a good link, I hope

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

Ok I realize I'm bumping a four year old thread, but the reason is to clarify for anyone who get here by googleing for "fstream tutorial". The tutorial above is somewhat obsolete now -- such as using #include <fstream.h> should now be #include <fstream> without the .h extension.

The OP -- FireNet -- also posted a link to updated code -- that link no longer exists.

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

Do you mean this function ?

Not exactly -- use ifstream declared in <fstream> file and its >> operator or getline() function to read data into a variable.

Here is one of many tutorials you can find on the net

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

All three do the same thing but in different ways -- ODBC is the oldest and best supported method of accessing an SQL database. It is supported by virtually every SQL database and 32-bit c/c++ compiler. The other two originated at Microsoft. OLEDB and ADO

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

>>Further, when I set the new radius, can it be done in a loop inside that function, rather
>>than calling it individually for 21, 22, 23, 24 etc?
I don't know. You probably should post the exact problem.

Warning: be cautious of doing that because some professors may consider it cheating.

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

Here is an example

// create instance and use default constructor
sphere obj; 
// create another instance but specifiy the radius
int radius = 20;
sphere obj1(radius);

// now change the radius
radius = 21;
obj.setradius(radius);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>#include "Thefunctions.cpp"
It doesn't matter how you wrote it -- never ever do that! No excuses.

What compiler are you using anyway.

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

line 27, you have to pass the pointer CF5 by reference, you are only passing it by value. I only show the corrections to a few lines. Function resize_long_pointer() will require several other corrections to accommodate the double star (pointer to a pointer)

// line 13:
void resize_long_pointer(long **,long *);
...
// line 27
resize_long_pointer(&CF5,&N_Cell_total); 

// line 36
void resize_long_pointer(long **pointer,long *add_size)

Another option is to change resize_long_pointer() to return a pointer long * resize_long_pointer(long *,long *);

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

I gave you the help you needed. Did you figure it out yet?

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

works for me.

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

Where?

All over the new testiment.

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

thank you,
I'll keep that in mind when I update my long term goals.
PS. as I m using guru.com and not happy/ is it OK to adv for a web master or other through postings or only thru the google ads I see?
as a moderator I guess you would know?
ray

Do you mean these boards?

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

since you reposted your code I deleted the post on the c++ board.

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

>>get a fair amount of warnings, but i can live with warnings
You are crazy if you do because most warnings are really errors. Fix them.

line 2: never ever at any time should you include one *.cpp in another like that. Compile them separately and link them together. That's what compilers do.

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

post the code you have written. Start very simply and do the requirements one at a time.

Step 1: For example, "Write a c++ program". Well, here it is

int main()
{
    // code goes here

}

Step 2: Next you need to create an int array that takes 100 numbers.

Step 3: Then fill it with random numbers between 3 and 90.

That should give you a good start on the program.

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

for (int d=0;d< fn.length();d++)
file_num[d]=fn[d];

Why not just use the assignment operator ? No need for that loop file_num = fn; >>string file_name=loction+file_num+extention;
That is a little odd. Why not use the fd parameter and delete the loop quoted above ? string file_name=loction+fn+extention; >>ofstream ofile ("file_name", ios::out);
Remove the quotes. Also delete ios::out because that's the default for ofstream ofstream ofile (file_name.c_str());

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

post code. I can't see your monitor very well from where I am sitting.

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

Look at line 42: what do you see there? table is a two dimensional array.
Now look at line 31: the first parameter is a single dimensional array, not 2 dimension.

You will have to correct that inconsistency. I don't know which way you want it, but you can't have it both ways.

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

Your program is experiencing out-of-bounds errors. The arrays are allocated 17 elements numbered 0-16 and your program is attempting to write to elements 1-17. Element #17 does not exist.

Learn to count the C and C++ way -- with 0 as the base value. Your program is chuck full of buffer overruns and out-of-bound errors.

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

One way to do that is to create an integer to contain the sum of each group.

int sum1 = 0; // 0-20
int sum2 = 0; // 21-40
// etc for each group

Then while reading each value from the file compare it with the gruping

if( numRead >= 0 && numRead <= 20)
    sum1++;
else if( numRead >= 21 && numRead <= 40)
   sum2++;
/// etc

Another way is to use an array of ints, but if you have not studied arrays yet you might want to stick to the above method.

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

line 59: scoresAbovePar(table[STATS], handicaps,par, scores,count)

The first parameter is incorrect. Here's the correction:
scoresAbovePar(table, handicaps,par, scores,count)

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

Well, just do as I illustrated. We aren't going to do it for you.

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

first the program needs to generate a linked list of those structures. To do that you will have to prompt for the structure values then add the structure to the list. Put that into a loop until the user says he/she wants to stop. You could also expedite this by reading the data from a data file so that you don't have to type them every time you run the program.

After that is finished prompt for and get input for the IP address to search for. Then iterate through the linked list comparing the IP address of each node to the IP address you just entered.

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

So, what is the question? To replace the switch statement with a set of if statements

if( property_code == 'R' || property_code == 'r')
{

}
else if( property_code == ???
etc. etc.
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The or operator is combining those items. For example lets assume
#deifne CS_DBLCLKS 0x01
#define CS_OWNDC 0x02
#define CS_HRDRAW 0x04

So when they are or'ed you get 0x01 + 0x02 + 0x04 = 0x07

Here is a good beginning tutorial in win32 api programming.

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

Like this: cout << "1. - The number of legal golf scores above par is " << scoresAbovePar( <parameter list here> ) << endl << endl;

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

in c++ you have to transform each string to either upper-case or lower-case transform(string1.begin(),string1.end(),toupper); Or if you want to use C functions, most compilers has a function that ignores case, such as stricmp(string1.c_str(), string2.c_str())

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

you mean this? if( list.students[n].id == student)

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

No tutorial because each compiler does it differently. I don't know how Borland Builder 6 does it -- you should ask someone in the Borland support forums.

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

If you would erase() the element instead of replacing it with an empty string you wouldn't have the problem you are posting.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
cout << "1. - The number of legal golf scores above par is  " << scoresAbovePar << endl << endl;

	cout << "2 - The number of legal golf scores at or below par is  " << scoresAtOrPar << endl << endl;

	cout << "3. - The average of all handicaps for the golfers is " << setprecision(1) << avgHand << endl << endl;

	cout << "4. - The average of all scores for the golfers is " << setprecision(2) << avgScore << endl << endl;

	cout << "5. - The number of golfer who scored at their handicap is  " << scoreAtHand << endl << endl;

	cout << "6. - The number of golfers who scored worse than their handicap is  " << scoreWorse << endl << endl;

	cout << "7. - The number of golfers who scored better than their handicap is " << scoreBetter << endl << endl;

	cout << "8. - The number of illegal values found is  " << illValue << endl << endl;

scoresAbovePar is a function, not a data element. All you are doing in the lines posted above is printing the address of those functions. You have to call them just as any other function.

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

Solution, get the convicts to build the bridges in return for early release

I wouldn't want to drive across a bridge that was built by a bunch of convicts :S

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

--I am pretty sure that you have changed you color scheme in the OS of your choice at some point of time. No?
>>No.

Great. So, what OS are you using?

Vista Home Premium.

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

Please don't manually add line numbers because compilers don't like them. The code tags will insert line numbers for you. Please repost code without manual line numbers

[code=cplusplus] // put your code here

[/code]

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

and this is the output csv file

,,,,,,DAY 1,DAY 2,DAY 3,DAY 4,DAY 5,DAY 6,DAY 7,DAY 8,DAY 9,DAY 10,DAY 11,DAY 12,DAY 13,DAY 14,DAY 15,DAY 16,DAY 17,DAY 18,DAY 19,DAY 20,DAY 21,DAY 22,DAY 23,
Application Name,Project ID,Work Item,Activity,FTP Allocated
1,1,1,1,0.86,,0,0,-4.22017e+037,6.8,0,0,0,0,6.8,7.2,6.8,6.8,6.8,6.8,7.2,6.8,6.8,6.8,6.8,7.2,6.8,6.8,7
2,2,2,2,0.12,,1,1,1,1,0.8,1,1,1,1,0.8,1,1,1,1,0.8,1,1,1,1,0.8,1,1,0.9
3,3,3,3,0.02,,0.2,0.2,0.2,0.2,-0,0.2,0.2,0.2,0.2,-0,0.2,0.2,0.2,0.2,-0,0.2,0.2,0.2,0.2,-0,0.2,0.2,0.1

,,,,,Total Hours,1.2,1.2,-4.22017e+037,8,0.8,1.2,1.2,1.2,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8


,,,,,
,,,,,Final FTP Differences -->

,,,,,ACTIVITY,FTP Difference,HOUR Difference
,,,,,1,0.005,0.04
,,,,,2,-0.0025,-0.02
,,,,,3,-0.0025,-0.02
,,,,,Difference Sum,0,0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There is a definite problem in your program some place because the program crashes at the end. After I press any key to continue it crashes.


Activity 2 -->
Application Name : 2
Project Id : 2
Work Item1 : 2
Activity : 2
FTP : .12

Activity 3 -->
Application Name : 3
Project Id : 3
Work Item1 : 3
Activity : 3
FTP : .02


Calculating. Please wait.
Calculation Done.
Writing To File. Please Wait...

Done 100%
File Writing is done.

PRESS ANY KEY TO CONTINUE

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
ilc * get_activities(ilc * ob)
{
	do
	{
		cout<<"\n\n Enter No. of activities : ";
		cin>>::noa;

		ob = new ilc[noa];

Why is ob even a parmeter to that funciton ? You might as well just make it a local variable.

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

>>its calculating fine
Not with the bug Laiq found. The program is attempting to use an uninitialized variable which can cause any number of program errors.

ilc *ob = NULL;	
ob=get_activities(ob);

[edit]You're right -- after looking at get_activities() the above really isn't a problem. But you should initialize ob to NULL anyway.

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

Is there a difference between the data that works and the data that doesn't work?

I got it to compile with VC++ 2008 Express. Please post the entries that work ok and an example of the entries that do not work.