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

use either global or static local variable then just increment it at the beginning of the function.

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

Did you try google ?

>>if any one can help by friday 21-march
many people will just ignore you if you add a date-due to your pose. Your suspense date if your problem, not ours.

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

baccount..h lines 20, 21 and 22. You need to specify the return type, such as int. Why are you using ints for balance, deposits and withdrawals -- only whole values acceptable with no cents ?

There are many many more errors due to not including the function return types and using int instead of float or double. I'm not going to tell you where the errors are because you can read this yourself from the error/warning messages you compiler spits out at you.

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

try this:

string reverse(string line)
{
	int len = line.length()-1;
	string clean;
	while( len >= 0)
	{
		clean += line[len--];
	}
	return clean;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

ERRORC = (( target1 ) - ( OUTC ) )(OUTC)(1 - OUTC); That statement contains mismatched parentheses. Count them and you will see that there are too many of them. You can't do multiplication with the (xxx)(yyy) syntax, meaning xxx times yyyy. You have to use the * operator if you intend to do multipliation, like this: ERRORC = (( target1 ) - ( OUTC ) ) * (OUTC) * (1 - OUTC);

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

Jonathan Archer.
We have to remember that the special effects used in the movies and the other Star Trek series had not yet been invented when the original Star Trek was made. So of course, it looked more "corny" than the others. They were working on a shoestring budget too.

Some of the low-budget films and series are actually better than more modern make-overs. That was true of both Start Trek and Dr. Who.

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

LOL AD when I said "how am I suppose to Know, its a figure of speech" I was talking about the fact that you said I called Narue a Dude when she is a female, and I said "how iam suppose to know"

I think Iam always being misunderstood on here, lets get back to the issues

Oh I see, sorry for the misunderstanding (generation gap I suppose). You can get a hint by her avatar -- it is wearing a dress. But that doesn't mean much either nowdays :)

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

>>how am I suppose to know, its a figure of speech
You are supposed to compile it then ask questions about what you don't understand. We aren't human compilers you know.

You DO have a computer (yes I know you do or you wouldn't be posting here) and a compiler (yes there are lots of free ones). So failing to do your own compilng is a very poor excuse.

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

how about this AD

what does your compiler tell you?

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

whatever dude you are just rude about it and you self proclaiming being the "Expert Meanie" says it all

Narue isn't a dude. Do you always call women that? And stop the flaming or you'll get hit with a stick and this thread will get closed.

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

>>You wanted us to tell you exactly what was wrong with your code and how to fix it, it seems.
I agree -- maybe I should have just kept quiet, but I just can't help myself :)

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

>> inheritance can always be used in place of composition, and vice versa.
Oh??? How can virtual functions be implenmented with composition?

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

only line 13 because lines 13 and 15 are identical, so it doesn't matter whether num % 2 is 0 or not.

and line 12 is wrong too because you used the = (assignment) operator instead of the == (boolean) operator.

Narue is attempting to get you to find the errors yourself. All the errors I pointed out (except the lines 12-15 problem) were probably reported by your compiler. Look at the first error, correct it, recompile then repeat this until all errors are fixed. Most compilers will tell you exactly where the errors are. But I must admit that sometimes (ok often) the error messages may be obscure and not tell you very much.

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

line 10: Since Afile is an input file you can't use the << operator. So you probably meant to use cout instead of Afile to print the text on the screen.

lines 12 to 15: There is no difference between those conditional statements so you might as well not have the if/else clause at all.

line 14: else is mispelled -- there is no capital E in else.

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

Welcome to DaniWeb

>>i was told that by doing IT i need another booster studies in programing language's. is it a must?
Only your university or college can answer that. Ask your college counsler.

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

so u ppl mean i shouldnt be using this type of weird and idiotic code...rite??
:D
okkk...thanx for help anyways... :)

We aren't saying that at all. What we are saying is that you need to learn how to use pointers. What you have posted so far is misusing them. Pointers are a very important part of the C language, so you need to learn them.

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

>>instead both of them worked well and fine
Only because you were lucky.

A pointer must point to something before its used, or memory must be allocated to it as in my previous example. If you fail to set a pointer to something then you will have huge problems in some larger programs.

If you don't believe me, then what can I say except for you to read your textbook about pointers. One of our members WaltP has a very good signature

If you walk on broken glass expect to get cut

or something like that.

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

>>it goes back and asks for another letter input without an infinite loop?
Put lines 47 to 74 in an endless loop or a conditional loop when ends when some condition is met.

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

This article was written for Java but applies to C++ too.

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

Here is one explaination, but the examples are not good. Below is corrected example. Test it out on your own computer by comparing the outputs with and without the virtual keywords.

#include <iostream>
using namespace std;

class Base
{
       public:
          Base(){ cout<<"Constructor: Base"<<endl;}
          virtual ~Base(){ cout<<"Destructor : Base"<<endl;}
};
class Derived: public Base
{
     //Doing a lot of jobs by extending the functionality
       public:
           Derived(){ cout<<"Constructor: Derived"<<endl;}
           virtual ~Derived(){ cout<<"Destructor : Derived"<<endl;}
};
int main()
{
        Base *Var = new Derived();
        delete Var;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Is this a C or a C++ program? The subject of your thread says C++ but the description of the problem says C everywhere. The answers to those questions will depend on which language is being used. For example: in C you would use fgets() to get an entire line including spaces, but in C++ you would use getline().

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

In each of your examples pointer p was never initialized to point to any memory so what you get is a crashed program.

And Yes, in each of the cases you statef for Q 1 a new variable name is created and occupies stack space. If all you want to do is reduce stack size then using a pointer to pass an integer will do nothing to improve that because in most operating systems today the size of a pinter is the same as the size of an integer.

In Q2: its an invalid statement. Here is a better, and more frequently used, example. Note that the pointer **n is a pointer to a pointer.

void foo(int ** n)
{
    *n = malloc(16 * sizeof(int)); // allocate an array of 16 integers
    for(int i = 0; i < 16; i++)
       (*n)[i] = i;
}

int main()
{
     int* p= 0;
     foo( &p );

    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

when I ran the program it worked as written except for changin <= 10 to < 10, as I stated in my oroginal post.
[edit]Oops! not it doesn't work right. [/edit]

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

All you have to do is replact <= 10 to < 10 in each of the two loops for(int x = 1; x < 10; x++)

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

I already showed you the code to do it. Just paste that line after main().

#include <ctime>
// other includes here

int main()
{
   srand( time(0) );
   // other code here
}

The time() function gets the current system time in seconds since 1970. So every time you run the program time() will return something different.

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

>>n wht abt making files ( to save data when using program ) ..
Yup -- your program will need to do that too. You have to design what the file contents look like then write them according to your design.

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

you need to seed the random number generator. Most people see it with the current clock time of the computer

#include <ctime>

...
srand( time(0) );

Depending on your compiler you may need to typecast the return value of time() to size_t.

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

Ancient Dragon..... I am new to this site and wud love to know how do u write the program to appear as like..... U know what I mean,

I'm afraid I don't know what you mean. appear as like what ? Do you mean the line numbers I added to your original post?

[code=cplusplus] // put your code here

[/code]

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

On *nix all you have to do is pass the right arguments in the open statement and it will work the same way as CreateFile() odes. check your compiler to see if it has fsopen() because I'm not sure if that function is standard C or not.

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

>> i if i pass a pointer then i will have to receive it by a double pointer...else the change wont take place in the original pointer variable...

No, it doesn't work that way. You don't need to change the pointer itself, only the array inside the class. I know below isn't exactly how you are using it but illustrates how to use a pointer object. Note that function foo() is not changing the value of the pointer so there is no need to pass the array pointer by reference.

int foo( int* array)
{
   for(i = 0; i < 10; i++)
      array[i] = i;
}

int main()
{
    int array[10] = {0}
    foo(array);
    cout << array[0] << "\n";
    return 0;
}

In this example, the array pointer DOES need to be passed by reference because function foo() is changing it

int foo(int **array)
{
    *array = new int[10];
    for(int i = 0; i < 10; i++)
       *array[i] = i;
   return 10;
}

int main()
{
   int *array = 0;
   foo( &array );
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>needs a lot of work and practise
Yes, programming is probably the most time consuming course you will ever take, depending on how quickly you learn.

>>my lecture said we must read the textbook from cover to cover maybe 5 times but not less than that
You have a very good and competent instructor :)

Now tell me... if u said I must delete those statements which asking the user to make a selection where am I suppose to do that..... inside do... while.... I guess but how is the program gona know that when the key "1" is pressed had to go back and prompt the user to make a selection

Move lines 30 and 31 down a bit to inside the do loop, immediately after line 34.

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

You could display the message in another thread. Before calling the dialog's DoModal() create a thread and have it display the message for however long you want it visible. Call win32 api function CreateThread() to do that. The function isn't very difficult to use because some of the parameters can be just 0 so that it uses default values.

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

Its not necessary to pass those pointers by reference because the functions aren't changing them. Passing by reference in those functions does nothing more than bloat the code. Just pass the pointers instead.

>>++mat->element;
You don't want to do that. Do it like this:

for (int j = 0; j < mat->columns; ++j)
{
        print << mat->element[j] << "  ";
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> "U better get it all wrong than copying it or writting something that u dont understand coz U gona get 0 if u cant explain what u did or u have copied it"
Good for your instructor :) :) I'm not about to rewrite your program for you because I don't want you to get a 0 one the paper. Its better that there are a few errors in the program than to make it look like you didn't write it.

line 10: you need to initialize the array to 0 like this: int quantity[6] = {0}; line 40: This is where you seem to be having lots of problems with the array. That array has 6 elements -- the first one is number 0 and should represent the quantity of "Floral Dreams" purchased. Therefore you want to enter a value in quantity[0] like this: cin >> quantity[0]; In the next case statement it shoule be quantity[1], then in the next quantity[2], etc.

lines 12 and 14: you can't use the same variable name more than once.

lines 42 and 43: you don't need those lines at all. Just delete them and similar lines in the other cases.

line 90: this is another common error -- the array elements range from 0 to and including 5, the for loop should be for( i = 0; i < 6; i++) . Note that all you have to do in your program is replace the <= symbol with just <.

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

The function beginning at line 52 inserts a new node at the head of the linked list. It does this by first setting the new nodes's link pointer to the current head, then changing the current head to be the new node. The function looks like it will work correctly.

>>And i think my output function is not right
You are correct -- that function is not correct because it needs a loop to iterate through the linked list and print them one at a time

while( temp != NULL)
{
    // print the node's data is not shown

   // advance to the next node
   temp = temp->Link;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

From the error description I think the Elec class contains one or more pure virtual functions. If that is true then you can only allocate derived classes.

>>Can somebody have an idea to how to solve this issue??
allocate componment to be one of the derived classes.

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

Were is the program you wrote? Or did you answer the questions at all ? If you couldn't answer the test then you need to restudy your text book from page 1 and do all the extercies at tne end of each chapter. If you don't do this then you might as well drop the course and take up basket weaving.

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

Put all the text in the box into a String, not necessarily what's at the current cursor position. But look in MSDN at the methods available for the text box and see if there is an easier way to do it, but I doubt it.

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

If that text box is like MFC then you have to get the string that's already in the box, make whatever changes you want, then put the entire string back.

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

>>any other suggestion?
Make it fit your situation. You won't find any perfect code you can plagerize, so think how you can incorporate it into your own program. If you don't want it to clear the screen then don't use that part. The purpose of that code (or any other examples for that matter) is to just give you some hints about how to write your own program.

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

To be be frank I think you are about 10 years too late to be starting a new career in computer programming You might be able to find an intro position somewhere but companies will want to hire much younger people with no experience. I actually begam mine when I was about 43 in 1986, but that was when the programming field was pretty much wide open to anyone who wanted it.

The most pleantifuly jobs in the USA have been for many years in the mid-west. There are many starving programmers on both coasts.

Education: If you already have a bachelors or better degree then a couple years studying programming at a tech school or junior college might be enough. Otherwise you will most definitely need to get a bachelors because the competition is probably just too greate without it.

If you have the managerial experience for it you might have better chance to get a IT manager's job, such as a team leader. You might also look in areas around major military installations because programming contractors in those areas tend to hire somewhat older people.

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

It's just a simple function call. Read this:. The paramter [x] would be the value of e (whatever that is) and the paramter y is the calculation -((W1A * pix1) + (W2A * pix2)));

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

Very humerous and very very true. I saw a lot of drunks like that when I tended bar 30 years ago.

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

your code needs to call pow() to raise x to the power of y. Don't know what exp is in your code.

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

We've already had one thread with this exact problem today. Read the responses in that thread.

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

>>I don't understand where exactly to put
constants normally go right after the includes and before any function.

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

Here are some starter tutorials for MS-Windows operating system.

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

The problem was the way the files were being read in main(). Attached is a corrected copy of the cpp file.