Forum: Shell Scripting Nov 28th, 2008 |
| Replies: 5 Views: 803 |
Forum: Shell Scripting Nov 27th, 2008 |
| Replies: 5 Views: 803 Hi eggi,
Thank you for your reply. I don't want to remove all the line that begin with a pound character and then start with ifndef,define or endif. I just want to remove the three lines in... |
Forum: Shell Scripting Nov 26th, 2008 |
| Replies: 5 Views: 803 Some of my source files include the following code.
#ifndef AAAAAAAAAAAA
#define AAAAAAAAAAAA
#if !defined(__lint) && !defined(_lint)
XXXXXXXXXXXXXXXXXXXXXXXXX;
#endif
#endif |
Forum: C++ Nov 21st, 2008 |
| Replies: 5 Views: 1,416 Maybe, you confused the functionality of Event struct and Node struct.
There are two ways to reach you objective.
First,
struct EventNode
{
tm startTime, endTime;
string eventItem;
... |
Forum: C++ Aug 29th, 2008 |
| Replies: 7 Views: 992 Thank you.
In fact, I have written test program and have run a lot of test case, all those case were OK.
I just want that is a standard of C++ or just dependent on the compiler( I used Dev-C++... |
Forum: C++ Aug 29th, 2008 |
| Replies: 7 Views: 992 Thank you for your reply.
In my example, Do you mean the default behavior is call the operator= of class B? If the default behavior is just memory copy and class B have pointer member, it will... |
Forum: C++ Aug 29th, 2008 |
| Replies: 7 Views: 992 Does it need a copy constructor and an operator= for a class which have array member?
for example:
Class A
{
private:
B data_[100]; //B is a class
};
does class A need a copy... |
Forum: C++ Aug 29th, 2008 |
| Replies: 2 Views: 314 Please see my comments below |
Forum: C++ Aug 28th, 2008 |
| Replies: 6 Views: 1,560 Sorry for troubling you with the windows.h. I included it just for using Sleep function to debug your code. After debugging I deleted the Sleep function but forgot to delete the windows.h. |
Forum: C++ Aug 28th, 2008 |
| Replies: 6 Views: 1,560 I think you maybe misunderstand the meaning of index and size. There are some errors in your code, please see my comments below. I attached my code, which is base on yours. Please refer to it. |
Forum: C++ Aug 27th, 2008 |
| Replies: 7 Views: 586 I did not understand your algorithm for predicate whether two number are equivalent.
I think at least the equivalent function should return a bool value. |
Forum: C++ Aug 27th, 2008 |
| Replies: 7 Views: 586 Which container do you use to store the number? vector? list?
if you use list, you can use the unique(op) function to eliminate the duplicate number. the op is a function or a functional object used... |
Forum: C++ Jul 28th, 2008 |
| Replies: 3 Views: 1,085 |
Forum: C++ Jul 28th, 2008 |
| Replies: 3 Views: 1,085 Why constructor can not be defined as virtual?
Thanks |
Forum: C++ Jul 16th, 2008 |
| Replies: 4 Views: 506 Thank you!
I don't know the answer of the second question: if pattern is a array, how to optimize it? |
Forum: C++ Jul 16th, 2008 |
| Replies: 4 Views: 506 Question is :
Write a function int f(char* str, long pattern) to find out how many pattern does the str contain? str is a char array consist of '1' and '0';
for example: str =... |
Forum: C++ May 8th, 2008 |
| Replies: 2 Views: 2,498 It wrong here:
for (counter = 0; counter < 6; counter++)
if(sellItem == itemName[counter])
if there are less than 6 item in itemName, it will occur memory error. |
Forum: C++ May 5th, 2008 |
| Replies: 4 Views: 1,540 I do not think this is what he want. I think his condition is like that:
there are a lot of line in file hello.txt , like
Set wallpaper=
Set color=
Set ....=.....
what he want is find out the... |
Forum: C++ May 5th, 2008 |
| Replies: 4 Views: 1,540 I am not sure I understand what you want. Maybe, the following code can help you. I write it using C++, you can translate it to C. This code can replace the text Set wallpaper="aaaa" with Set... |
Forum: C++ Apr 29th, 2008 |
| Replies: 5 Views: 923 What will happen if caught exception when new a object? For example:
ClassTest* ptr = 0;
try
{
ptr = new ClassTest;
}
catch(...)
{
} |
Forum: C++ Apr 28th, 2008 |
| Replies: 27 Views: 3,716 for (int k = 0; k < rowsb; k++)
{
sum = sum + matrixa[i * columnsa + k] * matrixb[k * columnsb + j];
matrixc[i * finalcolumn + k] = sum; //move this line out of this loop then use j replace k,... |
Forum: C++ Apr 28th, 2008 |
| Replies: 27 Views: 3,716 Sorry, my English is not so good. I mean that using
one_dimensional_array[i*column + j]
instead of
two_dimensional_array[i][j] |
Forum: C++ Apr 28th, 2008 |
| Replies: 27 Views: 3,716 for (int i=0; i<rowsa; i++)
{
for (int j=0; j<columnsb; j++)
{
float sum = 0.0;
for (int k=0; k<columnsa; k++)
{
//first, look it as a two-dimensions array,... |
Forum: C++ Apr 25th, 2008 |
| Replies: 3 Views: 552 kindly reminder, the sort function I posted don't work correctly, you should correct it by yourself. |
Forum: C++ Apr 25th, 2008 |
| Replies: 3 Views: 552 I have finished it, but to don't violate the rules of this website --"Don't give away code" , I can not give you all my source code. The following is the framework of program. hope it can help you.
... |
Forum: C++ Apr 25th, 2008 |
| Replies: 8 Views: 909 delete the ';' at the end of this line |
Forum: C++ Apr 25th, 2008 |
| Replies: 5 Views: 610 you can not pass an array to a function without tell the number of the array elements, otherwise, the number of the array elements will be unknown in the function.
you should define the function... |
Forum: C++ Apr 25th, 2008 |
| Replies: 5 Views: 610 I think it's more efficient than using pointer.
just be double. |
Forum: C++ Apr 24th, 2008 |
| Replies: 2 Views: 388 I found two problem.
1. if you use the following code to open a file, the file must exist before running your program.
f1.open ("doc1.txt", ios::in | ios:: out);
you can just use the default... |
Forum: C++ Apr 24th, 2008 |
| Replies: 8 Views: 1,238 Why you want to change vector<int> to float? Do you want to use the float total to store the sum of the exam codes? maybe you can add a member to your struct. like this:
struct exam
{
int... |
Forum: C++ Apr 18th, 2008 |
| Replies: 11 Views: 1,473 The various combinations of the flags and the corresponding meaning as below:
ios_base Flags Meaning
in Reads (file must exist)
out ... |
Forum: C++ Apr 16th, 2008 |
| Replies: 10 Views: 2,152 int len = strlen(sentenceHolder1);
for(int i = 0; i < len; i++)
{
if( sentenceHolder1[i] == look_for_character )
sentenceHolder1[i] = sentenceHolder1[0]; //I think this will be OK
}... |
Forum: C++ Apr 16th, 2008 |
| Replies: 9 Views: 5,245 |
Forum: C++ Apr 15th, 2008 |
| Replies: 10 Views: 1,292 I see, thank you for your answer. |
Forum: C++ Apr 15th, 2008 |
| Replies: 10 Views: 1,292 hi dougy83, thank you so much. maybe i got it;
in a singleton class, if a member function isn't dependent on whether the instance has been created or not, you can define it as static. so, user... |
Forum: C++ Apr 15th, 2008 |
| Replies: 9 Views: 5,245 You can not pass a array to a function without the element number of each dimension. in the function, it will not know the number of the elements.
1. you can use struct to pass multidimensional... |
Forum: C++ Apr 15th, 2008 |
| Replies: 10 Views: 1,292 I don't refer to the member function used to get instance(such as getInstance above) . I mean define the other member function as static(such as static int someFn(); above ), does this make any... |
Forum: C++ Apr 10th, 2008 |
| Replies: 10 Views: 1,292 For a singleton class, there is only one instance in a process, so it's not necessary to define a member function as static, am I right?
Thanks in advance. |
Forum: C++ Mar 13th, 2008 |
| Replies: 10 Views: 1,932 Do your address have space? cin can not read a string with space. maybe you should use getline to read the address. |