Click here to Skip to main content
15,889,315 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: Casting Problem for a beginner Pin
Nemanja Trifunovic6-Apr-04 13:16
Nemanja Trifunovic6-Apr-04 13:16 
GeneralRe: Casting Problem for a beginner Pin
BlackDice12-Apr-04 11:07
BlackDice12-Apr-04 11:07 
GeneralInvitation Pin
Member 7951483-Apr-04 6:23
Member 7951483-Apr-04 6:23 
Generaladding managed extensions - Error! Pin
BlackDice2-Apr-04 3:40
BlackDice2-Apr-04 3:40 
Questiondo get_ and set_ have to be used in conjunction? Pin
charlener1-Apr-04 16:28
charlener1-Apr-04 16:28 
AnswerRe: do get_ and set_ have to be used in conjunction? Pin
charlener1-Apr-04 16:29
charlener1-Apr-04 16:29 
AnswerRe: do get_ and set_ have to be used in conjunction? Pin
Andy Wieberneit1-Apr-04 20:03
Andy Wieberneit1-Apr-04 20:03 
GeneralIterate through vector Pin
wadstar31-Mar-04 8:15
wadstar31-Mar-04 8:15 
hi me again, ive been writting code that fills a vector with random numbers from two sources, all even elements are filled from source1 and odd ones from source2...this now works fine after much debuggingmyhead.

ive been trying to to do next part of my function which is more complex, it basically uses a iterator with a const value of 0.002. which is 20millseconds.

this iterator goes to every single element in the array and goes through every element in 0.002 segments..i.e if element value is 3.6 then it goes through it in 1,800 segements. basically splitting up the element into segments,

and it does this to distingusih between numbers from sourceone and sourcetwo because these numbers are usesd elsewhere.. i will paste the code which fills the vector and ive COMMENTEDout the 'new' but it doesnt work imnot sure what else to do.

#include <iostream><br />
#include <vector><br />
#include <stdlib><br />
#include <time><br />
#include <numeric><br />
#include <algorithm><br />
#include "exponentialgenerator.h"<br />
<br />
using namespace std;<br />
<br />
ExponentialGenerator one = 1.41;<br />
ExponentialGenerator two = 1.71;<br />
<br />
double nextNumber = reinterpret_cast<double>(one.generate());<br />
<br />
double nextNumber2 = reinterpret_cast<double>(two.generate());<br />
<br />
int counter = 0;<br />
<br />
void fillVectorToSum(vector<double>& v, double sum)<br />
{<br />
<br />
    int total = 0;<br />
    do {<br />
		if (counter++ % 2){<br />
			v.push_back(nextNumber);<br />
			total += nextNumber;<br />
			nextNumber = one.generate();<br />
			}<br />
		else {<br />
			v.push_back(nextNumber2);<br />
			total += nextNumber2;<br />
			nextNumber2 = two.generate();<br />
			}<br />
<br />
    } while(total+nextNumber+nextNumber2 <= sum);<br />
    if(total < sum)<br />
        v.push_back(sum-total);<br />
}<br />
<br />
/**void goThroughVector(vector<double>& doubleVector, const vector<double>::iterator imMutableIt, double currentElement)<br />
{<br />
	*imMutableIt = 0.002;<br />
<br />
	doubleVector.push_back(1.0); <br />
	doubleVector.push_back(2.0);<br />
<br />
	imMutableIt it = doubleVector.begin();<br />
	<br />
<br />
     double currentElement; <br />
	<br />
		 while (*imMutableIt = 0.002;){<br />
			 if (currentElement = nextNumber)<br />
				return currentElement;<br />
			 else (currentElement = nextNumber2)<br />
				return (currentElement*10);<br />
		 }<br />
	imMutableIt endIt = doubleVector.end();<br />
<br />
<br />
}**/<br />
int main()<br />
{<br />
<br />
    srand((unsigned) time(NULL));<br />
    vector<double> v;<br />
    fillVectorToSum(v, 30);<br />
<br />
    cout << "Number of elements: " << v.size() << "\nTotal: "<br />
         << accumulate(v.begin(), v.end(), 0) << endl;<br />
    copy(v.begin(), v.end(), ostream_iterator<double> (cout,"  "));<br />
	<br />
	<br />
<br />
<br />
<br />
<br />
}

GeneralManaged C++ and AfxOleInit Pin
mstanciu200030-Mar-04 21:29
mstanciu200030-Mar-04 21:29 
Generalcustom window drawing Pin
Darmochwal Robert30-Mar-04 10:36
Darmochwal Robert30-Mar-04 10:36 
Questionhow to get the handle of the RICHEDIT Pin
dilip_sar30-Mar-04 10:32
dilip_sar30-Mar-04 10:32 
AnswerRe: how to get the handle of the RICHEDIT Pin
ravjak1-Apr-04 4:32
ravjak1-Apr-04 4:32 
Questionhow to send text to another window Pin
dilip_sar30-Mar-04 9:34
dilip_sar30-Mar-04 9:34 
AnswerRe: how to send text to another window Pin
ian mariano30-Mar-04 9:49
ian mariano30-Mar-04 9:49 
GeneralSerialComm Pin
kwisslk30-Mar-04 7:40
susskwisslk30-Mar-04 7:40 
GeneralRe: SerialComm Pin
Andy Wieberneit30-Mar-04 23:33
Andy Wieberneit30-Mar-04 23:33 
GeneralRe: SerialComm Pin
okoji6-Apr-04 22:09
sussokoji6-Apr-04 22:09 
GeneralRe: SerialComm Pin
User 91483318-Apr-04 13:12
User 91483318-Apr-04 13:12 
GeneralChange Text (Caption) Color for a MFC Button Pin
HaHa!30-Mar-04 4:54
HaHa!30-Mar-04 4:54 
GeneralRe: Change Text (Caption) Color for a MFC Button Pin
Renjith Ramachandran7-Apr-04 21:14
Renjith Ramachandran7-Apr-04 21:14 
Generalnewbie question Pin
charlener29-Mar-04 7:23
charlener29-Mar-04 7:23 
GeneralRe: newbie question Pin
zena992-Apr-04 8:24
zena992-Apr-04 8:24 
Generalusing iterator to count though vector Pin
wadstar29-Mar-04 6:25
wadstar29-Mar-04 6:25 
Generalunmanaged class declaring managed member function as friend Pin
godzooky29-Mar-04 4:15
godzooky29-Mar-04 4:15 
GeneralRe: unmanaged class declaring managed member function as friend Pin
Andy Wieberneit30-Mar-04 0:21
Andy Wieberneit30-Mar-04 0:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.