User Profile
Collapse
-
That's right. It works now. Thanks -
How to pass two dimensional array in Java
Hi all,
I am trying to pass a two dimensional in java but there a problem in this function
Please what is the problem in this lineCode:public static void doOutput(String args[], double vector[][40]) -
conditional jump or move depends on uninitialised value(s)
I am using valgrind leak memory to check my program this message appears a lot of time, the program works but why this message.
example code
...Code:double RandNum,pp; double axis=AXIS; double wise_profit=0.20; double mu, delta,a,b; double sattisfic_price; RandNum=Rand.getRandomFloat(); if(prod_size<=prod_sold && prod_sold>0) SetPrice(GetPrice()+axis*RandNum); -
What I am talking about, I reserved a space for the array x and another space for each x[i], but in x[i] there is a space for 4 floats, What I am worried about is that space for 4 floats, In my opinion I didnot free memory for this space.Leave a comment:
-
Free Memory
Hi All,
I have a simple question. about free memery, I feel this is one of many reasons that make the memory crashing.
if we have the following array
...Code:x=new float*[n]; if(x=NULL) { exit(1); } for(int i=0;i<n;i++) { x[i]=new float[4]; if(x[i]=NULL) { exit(1); } x[i][0]=0; x[i][1]=0; -
Thanks for your explanation. I think, I did not give a good vision of my problem.
I can explain my problem as follows:
I create one array of Firms (ArrayFirm). And each object (ArrayFirm[i]) has an array of float. After, finishing the first round, my objects (ArrayFirm[i]) I do not need anymore and I would like to delete them, in the maintime, new object i would like to add, some will exit and others will entry, the problem...Leave a comment:
-
Copy Array of class pointer to another
Hi All,
Now, I am trying to build a project, I need to expand an array of pointer to classes. Moreover, this array includes some elements I want to delete them. So, I create another array, copy the elements which i want to keep and copy this array to the original one as follows
...Code:This function to create two arrays it depends on the parameter x. void Econ::CreateFirms(int array,int x) { if(x==1) -
It is too complicated structure, But I can summarized as follows
first, I created a pointer to class sys
second, In the constructor of that class I created a pointer to array of another class E
third, In the constructor of each one of two I created three pointers, 1-for an array of class f, 2-is an array of class h and a pointer to a class G
when I am dealing with second, I choose the neighbour for the current E up and...Leave a comment:
-
When I am using a different operating system and different complier the error is stack errorLeave a comment:
-
Cannot access memory at address 0x4c6d000
Hi All,
I have a problem when I am trying to implement my program, This problem is "Cannot access memory at address 0x4c6d000".
What I did is as follows:
1- Create a pointer to array of classes
2- call a function from one of these class that it returns pointer
Thank you for your help -
This is the new trial that i am trying to use string but there is many problems so I thought to use char
[code=cpp]
string int2string(cons t int& number)
{
ostringstream oss;
oss << number;
return oss.str();
}
string FILENAME;
for(int i=0;i<numEco;i+ +)
{
FILENAME="inf_h _";
FILENAME+=int2s tring(h);...Leave a comment:
-
I was tried to use itoa, but compiler complains, Also, i am using c++ with Cgywin complier...Leave a comment:
-
With string we can use a function strcpy, but with character variable it is not available to do this
I mean, I would like to change my filename within a loop
filename1.txt
filname2.txt ...etc...Leave a comment:
-
Append a number to set of characters
Hello Everybody;
I would like to append a number to set of char, I do not like to use string, because In my project I am using several files.
What I did but there is a problem with it is as follows
1. char filename[30];
2. int x=2;
3. filename="xxxxx ";
But i do not know how to append 2 to filename.
Thanks -
it is zero. And I did not open my account for more than 12 hoursLeave a comment:
-
to sicarie
what is the problem, you send me a message, i do not know the reasons to tell me something like that why? what happen?Leave a comment:
-
I think it is good idea, thanks a lot.
The only way that I found to use ostringstream is by adding std::ostringstr eam also, when I'm trying to define a string variable;
string var;
it is not accepted as a variable type
So, array of char is the alternative way to deal with it. But what is c.str()?.
The idea that i need to do, my program will generate a series of output files, and i need to distinguh between these...Leave a comment:
-
char filename[25];
std::ostringstr eam oss;
oss<<"inf_h_"<< x<<"_f_"<<y<<". txt";
filename=oss.st r();
this is a part of my code,
the error message is : incompatible types in assigment of 'std::basic_str ing(char,std::c har_traits<char >, std::allocator< char>>' to char[25]
also, i tried to use pointer to char, but error messages appears.Leave a comment:
-
Thanks it works, but i need to put this string in another variable, for instance
char filename[25];
filename=oss.st r();
but the error message appears which is incompatible types in assigment of 'st::basic_stri ng<char,.....Leave a comment:
-
When I am trying to use ostringstream oss;
undecalare ostringstreamLeave a comment:
No activity results to display
Show More
Leave a comment: