I was wondering what i would have to do if i wanted to Write a program in Visual Basic but wanted to do some calculation(as to make it quicker) in C?

Like say i wanted to fine the average of.. bah a few hundered thousand numbers in an array. So i'd imagine that might take a little while in Visual Basic(maybe not haven't tried) How would i go about recieving a value from a value from C++?

Don't really need to know, i've just been wondering lately about crossing over languages.

I've made C++ console programs and VB apps work with values together before, but not directly. I used to make either program to save the numbers, and the other to load.
example # of numbers: 32000
(I just created this code out of concept and some logic. Not sure if it would check out with the compiler.)


Dim dblArray(0 to 31999) as Double
Dim intArrayNum as Integer
Dim CurrentSum as Double
Dim dblAvg as Double

'Saving Data
Open filename For Output As 1
For dblArrayNum=0 to 31999
Write #1, intArrayNum,dblArray(intArrayNum)
Next intArrayNum

'receiving and calculating part for VB(if you are 'going C++ to VB)
Open filename For Input As 1
While EOF(1)<>True
Input #1, intArrayNum,dblArray(intArrayNum)

For intArrayNum=0 to 31999
Next intArrayNum
/*C++. I'm learning more C++, but sloow progress. At least I can make programs crunch numbers. 

using namespace std;
ofstream read;  // global var
ifstream write;  // correct direction of input?
int main()
  int arrayelement; double sum; double avg;
  double array[32000]; //forgot what's the max
 //number of elements in a C++ array. let's say
// it can hold that much
for(arrayelement=0; arrayelement=32000; arrayelement++)
{ read >> array[arrayelement]; }
for(arrayelement=0; arrayelement=32000; arrayelement++)

return 0;

I'm so dizzy and I confused myslef after writing this code.... XD

This article has been dead for over six months. Start a new discussion instead.