WolfPack 491 Posting Virtuoso Team Colleague

Since you know the indexes, the number of indexes, and they are in sequence, all you have to do is,

// comment : Number of Indexes = N;
// comment : Index Array = Index[ N ];
Current_Index  = 0;
Loop_Counter = 0;
While Current_Index < N
        If Index[Current_Index] == Loop_Counter{
               Print Index[Current_Index];
               Current_Index = Current_Index + 1;               
        Else
               Print "-";
        Endif
        Loop_Counter = Loop_Counter + 1;
End While
WolfPack 491 Posting Virtuoso Team Colleague
cout << n1 << " + " <<  n2 << " = " << n1+n2  <<endl;
WolfPack 491 Posting Virtuoso Team Colleague
WolfPack 491 Posting Virtuoso Team Colleague

I have not used eclipse, so I don't know exactly what steps are needed. But I don't think there is any problem with your eclipse version. Looks like you are adding the source file to the .settings folder. Also the file does not have the extension of a C++ source file.

Try right clicking on the project name and see if there is an option like add source file . If there isn't, try reading the manual of eclipse. Doesn't matter which OS you use, the basic steps should be the same. So even the Windows Manual for eclipse would do.

WolfPack 491 Posting Virtuoso Team Colleague
Sulley's Boo commented: Konnichi wa Wolfiiiiiiiiiiiiiiiiii .. Shibaraku desu ne .. +4
WolfPack 491 Posting Virtuoso Team Colleague

make the following changes to the set function.

void LList::set(int c, int val)
{
	int i = size-1;
	current = head;
	while ( current != NULL )
	{
		if(i==c)
		{
			current->data = val;
			//cout<<current->data;
			break;
		}
		else
		{
			current = current->next;
			i--;
		}
	}
}

You can easily debug these type of programs by using cout . Next time when you are programming, check function by function first before debugging the whole program at once. Also, you are using too many member variables.

  • You are not using tail anywhere.
  • current and degree should not be member variables. They should be variables defined inside the functions. Having current and degree as member variables will give you some very hard to find bugs because they can be used and updated from any function and it is hard to keep track.

Figure out the way to stop printing the last + character. It can be easily done by having a check to find out if current->next is null or not.

Sulley's Boo commented: =D +4
WolfPack 491 Posting Virtuoso Team Colleague

Asig 2.cpp In function `void ManiMatrix()': 31

I don't see anything wrong with checkIfMagic . But what is this function void ManiMatrix() in the first warning? Also make sure that Mani is not a misspelling for Main .

WolfPack 491 Posting Virtuoso Team Colleague

when i try to call a .c file in antother i got a error for multidecalaration of main file.i prepare for a medical shop management using c language what can i do???

See if you have two main functions in both the 2 files. If you have 2, delete the one that is not needed.

WolfPack 491 Posting Virtuoso Team Colleague

I see....
Well then congratulations Bennet .. whoever you are.

WolfPack 491 Posting Virtuoso Team Colleague

who is bennet?

WolfPack 491 Posting Virtuoso Team Colleague

Rules.

And why are you spamming the board?
I am closing this thread.

WolfPack 491 Posting Virtuoso Team Colleague

congratulations! It works, albiet a bit inefficient.
As I said before, the only reference needed was x
and you pulled that one in as a value!
All you are doing by taking in all those other unneccessary references is to bring the variable scopes INSIDE the function. It works just as well if the variables were set as global. Aguments pass things in, not out!

I get the feeling that you have missed this point.
good luck.

No he has not missed the point. You have. Arguments can be used to pass things both in and out. Passing by reference can be used to get things out. It is also memory efficient because another copy of the variable is not created in the stack like it is done when you use passing by value.

invisal commented: That's why I don't get his point. +3
WolfPack 491 Posting Virtuoso Team Colleague

When you call the function calculation , you will have to pass the variable names that you want to get the output from.

int main(void)
{
    int num;
    int first, last, total;
    while (num != 0)
    { 
        cout << "Enter an integer (0 to stop): ";
        cin >> num;
        
        if ( num != 0)
        {               
            calculation(num, last, first, total);
            cout << "Last digit:   " << last << endl;
            cout << "First digit:  " << first << endl;
            cout << "Total digits: " << total  << endl;
        }
    }
    
    cout << "End of task.\n\n";
    system("pause");
    
    return 0;   
    }

You do not want to pass t1 as an input for calculation, so change it like this. You do not need t1 at all.

void calculation (int x, int &last, int &first, int &total)
{
    last = (x % 10);
    while (x>9) 
        first = x / 10;

    while (x>0)
    { 
          total++;
          x /=10;
    }
}
WolfPack 491 Posting Virtuoso Team Colleague

Hi, I'm stuck again :( I read up on the passing by reference topic, understood it but don't get the point on extracting multiple values from 1 input.

void calculation (int x, int &last, int &first)
{
    last = (x % 10);
    
    while (x>9) 
    first = x / 10;
    
}

I got this so far, x being input.
But it doesn't work for me... :'(

What are the problems you are getting? Passing by reference can be used when you want to update the values in last and first . Is that what you want to do?

WolfPack 491 Posting Virtuoso Team Colleague

You can do something like this.

int main()
{
    int num;
    cout << "Enter an integer (0 to stop): ";
    cin >> num;
    
    while (num != 0)
    { 
        cout << "Last digit:   " << last (num) << endl;
        cout << "First digit:  " << first (num) << endl;
        cout << "Total digits: " << total (num) << endl;
        cout << "Odd digits:   " << odd (num) << endl;
        cout << "Even digits:  " << even (num) << endl;
        cout << "\n";
        cout << "Enter an integer (0 to stop): ";
        cin >> num;
    }
    
    cout << "End of task.\n";
    cout << endl;
    system("pause");
    return 0;   
}

Contrary on what your programming lecturer says, using break is not bad programming practice.

And you are not using passing by reference. You are using passing by value.

WolfPack 491 Posting Virtuoso Team Colleague

The functionality is the same. The only difference is that the maximum delay possible by the second function is greate than the maximum delay possible by the first function. This is because the storable range of long is larger than int.

WolfPack 491 Posting Virtuoso Team Colleague

9999999999 cannot be stored in a long typed variable. You will have to use a double typed variable. However if you use double , you will have to change the condition inside the while statement. I will leave you to figure that out.

Edit:
Or use long long . Much easier.

WolfPack 491 Posting Virtuoso Team Colleague

Those statements are used to print a newline after 10 numbers are printed in a row.
% is the modulus operator. a%10 is 0 for numbers like 10, 20, and so on. So after the 10th number, the rest of the array is printed in a newline. The same happens after printing the 20th number and so on.

Comment out those lines and see how the output changes. The values printed will be the same, but the output will be in a single line.

WolfPack 491 Posting Virtuoso Team Colleague

What part to you not understand?

WolfPack 491 Posting Virtuoso Team Colleague

In case you didn't notice, the fellow wanted the code in C.

WolfPack 491 Posting Virtuoso Team Colleague

Try the Borland C++ Builder 6 Webpage. Google for it.

WolfPack 491 Posting Virtuoso Team Colleague

There is a spelling mistake with the function name. showlist() and showList()

WolfPack 491 Posting Virtuoso Team Colleague

> You should copy test to a folder in your PATH variable,
This is a really, no REALLY bad idea.

1. There is already a standard unix command line utility called 'test', so by just copying it to somewhere in your PATH you risk either deleting it, or masking it with your program because it's earlier in the PATH.

Thanks for the heads up. I know next to nothing about the UNIX utilities.

WolfPack 491 Posting Virtuoso Team Colleague

You should copy test to a folder in your PATH variable, or add the folder that contains test to the PATH variable.
Refer the Adding to PATH variable section in this link.

WolfPack 491 Posting Virtuoso Team Colleague

What error does the compiler give? At first glance I can't see any problem with the code.

WolfPack 491 Posting Virtuoso Team Colleague

Right. Now we all know what an address book is. So what has this got to do with C++?

WolfPack 491 Posting Virtuoso Team Colleague

Didn't your professor or anybody else at least tell you about this awfully fun site called http://www.google.com/ where you can type A-Star Algorithm in that cute little white box and press search to get some really nice links with more than enough information?

Salem commented: Yes indeed. Some people lack the basic nouse to go do some independent research on their own. +15
WolfPack 491 Posting Virtuoso Team Colleague

There is no big yellow button on this page is there?
There are several types of users of this or any other forum on this website or other websites:
1. Someone who has arrived from a Google or other search engine or agent or website link
2. Someone who has just registered in order to post a Reply to Thread
3. Someone who is a user and has learn how to use the website
4. Someone who is an expert user
5. Someone who is also not a native English speaker

The fact that the Post New Thread button had to be removed because people were clicking on it to reply to the thread. Just goes to show that people do make errors or they are ignorant or rather don't know the difference between Replying and starting a New Thread.

It is all a lot more complicated than many forums users even expert users think. For example, forums threads are often spoilt by users who reply to a thread with what is actually a new thread. My initial problem was that I didn't know where I should post my query as my problem could be posted in more than one category or in Daniweb's case Forums.

I must agree with ggeoff on this one. The five types given above pretty much covers all the users, and I think that it would be helpful to have a post a new thread button that can be …

WolfPack 491 Posting Virtuoso Team Colleague

Read the replies in this thread.

WolfPack 491 Posting Virtuoso Team Colleague

Since this thread is similar to a thread in the C++ forum, and duplicate threads makes it difficult to keep track of the replies, I am closing this thread. Refer this link for replies.

WolfPack 491 Posting Virtuoso Team Colleague

The icon is compiled into a .RES file, which is then linked to the executable file. Think of it like a static library file (.lib file). Once the library is linked and the executable is created, you don't need the lib file to run the exe file. Read this for more information on how to create, compile and link the icon file.

Or are you trying to change the icon file of an already created executable to which you do not have access to the source code?

WolfPack 491 Posting Virtuoso Team Colleague

In the vclskin2.zip file that can be downloaded from the above link, there is a folder called help file. And in that Help file there are instructions on how to install it in C++ Builder 6.

WolfPack 491 Posting Virtuoso Team Colleague

Try this download page. Figure out the rest yourself.

WolfPack 491 Posting Virtuoso Team Colleague

yup but where to find winskinc6.lib???

If this is a C++ Builder 6 Enterprise library, look for it inside the Lib folder of the CB6 installation directory. Also read the documentation for this TSkindata thing.

WolfPack 491 Posting Virtuoso Team Colleague

Because TMemo is a wrapper for the Windows Edit Box, I don't think you will be able to have different formats for different parts of text in the same memo. I think you will do better using the TRichEdit control.

WolfPack 491 Posting Virtuoso Team Colleague
WolfPack 491 Posting Virtuoso Team Colleague
WolfPack 491 Posting Virtuoso Team Colleague

I don't see any problem except, you are using <iostream.h>.

What problems are you having?

WolfPack 491 Posting Virtuoso Team Colleague

srand is a standard C++ function. So g++ also supports it. What is the problem you are getting?

WolfPack 491 Posting Virtuoso Team Colleague
WolfPack 491 Posting Virtuoso Team Colleague
WolfPack 491 Posting Virtuoso Team Colleague

No there is no specific forum for Windows Programming. You can ask in the C++ forum.

WolfPack 491 Posting Virtuoso Team Colleague

How do you recognize one paragraph from another? There is no standard way to separate paragraphs like there is to separate lines. So your first task is to clearly define what constitutes a paragraph.

Counting the number of '\n's is counting lines, not paragraphs. So you will have to think up something else or redefine the problem to count the number of lines in the file.

I think that counting the number of non-empty, printable lines should do the trick.

The start of a paragraph is indicated by beginning on a new line and ending without running to the next passage. Sometimes the first line is indented, and sometimes it is indented without beginning a new line.

WolfPack 491 Posting Virtuoso Team Colleague

Google for finding maximum in array C++

WolfPack 491 Posting Virtuoso Team Colleague

Hmm. Yeah. I felt something was not right there. Thanks.

WolfPack 491 Posting Virtuoso Team Colleague

the same way.

system("dir");
WolfPack 491 Posting Virtuoso Team Colleague

Remove the return statement in line 10, and you will get the display.

WolfPack 491 Posting Virtuoso Team Colleague

Haven't you written at least a "Hello World" program in C++ ?

WolfPack 491 Posting Virtuoso Team Colleague

If you have 50 questions, the following code will print 10 numbers within the range of 0 to 50. The same number may get printed multiple times, but you can get rid of that by modifying the code to re-loop if an already printed number is obtained.

srand( time(NULL) );
   for( i = 0; i < 10; i++ )
     printf( "Random number #%d: %d\n", i, rand()%50 );
WolfPack 491 Posting Virtuoso Team Colleague

I didn't go through all your code, but shouldn't you be using

cout << " Player " << player<< " wins. " << endl;

instead of

cout << " Player " << check << " wins. " << endl;

?

In any case, try to debug this first by yourself. Writing it all at once and then posting code in forum is not the way to program.

Start like this.

If the program displays "Player 3 wins" everytime, that means check always gets the value 3 . Now see where the value 3 is assigned for check , and find the reason.