Click here to Skip to main content
15,914,214 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to create a Windows XP style button with an image on it? Pin
Paksas31-Mar-04 9:35
Paksas31-Mar-04 9:35 
AnswerRe: How to create a Windows XP style button with an image on it? Pin
Gary R. Wheeler31-Mar-04 16:20
Gary R. Wheeler31-Mar-04 16:20 
AnswerRe: How to create a Windows XP style button with an image on it? Pin
Gary R. Wheeler31-Mar-04 16:22
Gary R. Wheeler31-Mar-04 16:22 
GeneralDialogBox Creation Pin
monrobot1331-Mar-04 8:59
monrobot1331-Mar-04 8:59 
GeneralRe: DialogBox Creation Pin
Neville Franks31-Mar-04 9:03
Neville Franks31-Mar-04 9:03 
GeneralTemplate Specialization Pin
Yaron12631-Mar-04 8:45
Yaron12631-Mar-04 8:45 
GeneralRe: Template Specialization Pin
antlers31-Mar-04 10:51
antlers31-Mar-04 10:51 
Generaliterate through vector Pin
wadstar31-Mar-04 8:16
wadstar31-Mar-04 8:16 
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 />
}

GeneralMember of domain Pin
orcun colak31-Mar-04 5:57
orcun colak31-Mar-04 5:57 
GeneralRe: Member of domain Pin
David Crow31-Mar-04 8:03
David Crow31-Mar-04 8:03 
GeneralRe: Member of domain Pin
Robert M Greene31-Mar-04 15:55
Robert M Greene31-Mar-04 15:55 
GeneralTextOut() Pin
ns31-Mar-04 4:49
ns31-Mar-04 4:49 
GeneralRe: TextOut() Pin
Prakash Nadar31-Mar-04 4:54
Prakash Nadar31-Mar-04 4:54 
GeneralRe: TextOut() Pin
ns31-Mar-04 7:03
ns31-Mar-04 7:03 
GeneralRe: TextOut() Pin
grigsoft31-Mar-04 8:29
grigsoft31-Mar-04 8:29 
GeneralRe: TextOut() Pin
monrobot1331-Mar-04 8:39
monrobot1331-Mar-04 8:39 
GeneralRe: TextOut() Pin
GflPower31-Mar-04 13:27
GflPower31-Mar-04 13:27 
GeneralFinding a structures address Pin
Xen3h31-Mar-04 4:27
Xen3h31-Mar-04 4:27 
GeneralRe: Finding a structures address Pin
David Crow31-Mar-04 8:06
David Crow31-Mar-04 8:06 
GeneralRe: Finding a structures address Pin
Prakash Nadar31-Mar-04 14:44
Prakash Nadar31-Mar-04 14:44 
GeneralRe: Finding a structures address Pin
gUrM33T31-Mar-04 16:47
gUrM33T31-Mar-04 16:47 
GeneralRe: Finding a structures address Pin
John R. Shaw31-Mar-04 21:56
John R. Shaw31-Mar-04 21:56 
Questionhow to draw the background bmp for the statusbar? Pin
benben31-Mar-04 3:52
benben31-Mar-04 3:52 
AnswerRe: how to draw the background bmp for the statusbar? Pin
Alexander M.,1-Apr-04 3:44
Alexander M.,1-Apr-04 3:44 
GeneralThank you very much! Pin
benben1-Apr-04 17:23
benben1-Apr-04 17:23 

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.