I have an application thats has been coded in C#. After build it generates a standalone dll file and the exe file.
I want to use this code in Matlab. I found out from this page that I can load the C# classes or codes into Matlab.
dll_in_matlab = NET.addAssembly('location to the dll file)
I have the code and the application buty unfortunately I do not understand C# at all. So after using this command I was able to see a .NET object in my workspace and this is what I got for its properties and its classes:
evmaps = NET.Assembly handle Package: NET Properties for class NET.Assembly: AssemblyHandle Classes Structures Enums GenericTypes
[code]....
This is the application it produces: [URL] and here is the virustotal result for my application just to ensure that its clean. [URL] .....
I am not a C programmer (or a programmer at all). I am just a hobbyist who writes random code (i.e.: ignorant).C is not my area, and I my experience with it is quite LIMITED!Today, I found out that if I need to get "square root" in C I will be in trouble if I depend solely on the compiler..Is it possible to make the compiler to generate smarter code for this (quite trivial code):
Code:
void intprime_c(unsigned long* fprimes, unsigned long count) { unsigned long divc = 3; unsigned long num = 2; unsigned long sqr; unsigned long pfound = 0; }
[code]...
By "without ugly hacks" I mean using already existing code that came with GCC. Because the others did not need ugly hacks to perform better (it is all about being fair).To compute the "square root" in x86 one just need 3 instructions:
fild fsqrt fistp
But the compiler is generating a call to a "fsqrt" function and wasting a lot of time by doing this. If not, then why is it taking so long? Is it something wrong in my code (at least the output was verified to be the correct)?
Time taken to get the first 2500000 primes (x86_64):
Assembly = 72.400s (human written, unoptimized, coder level: newbie (i.e.: ignorant)) pascal = 75.200s (written by the same person) C (fsqrt) = 83.600s (written by the same person) C (sqrt) = 85.900s (written by the same person)
If it matters, I compiled the C code with this command: gcc -O2 -fno-omit-frame-pointer -fPIC -c ./prime.
I wrote a program, that generates 20 random integers, and stores them in an array. Then I decided, to build more functions to it, i.e why not have it to display the lowest integer of an array. I created my function,
Code: int minValue( int field[ ] )
and got my code in side, which (technically) works. In my main() function I'm calling
Code: printf( "The smallest value of an array is: %d ", minValue( field[] ) );
and I'm getting an error trying to compile it.
Code: randomArray.c:62:74: error: expected expression before ']' token printf( "The smallest value of an array is: %d ", minValue( field[] ) );
the loop iterates the first time through qualifying for (count % 2 != 0) because count is at 1 so it stores the characters after the comma into tok and does it successfully according to my debugger.then the while itterates again because it doesn't qualify for the next if. this time it does qualify for count % 2 == 0 but my tok pointer is now null , how can that be? does it go null when the while loop itterates for the second time? that shouldn't be because my integer count doesn't reset?
My program will not run because of error LNK2028 "unresolved token" and error LNK2019 "unresolved external signal" and I do not know why. My teacher says that I need to make the constructor and display functions display class variables in different formats, but I do not know what to do with that. Here are my 3 files:
Header take 2.h:
#pragma once #include <iostream> #include <string> using namespace std; class Heading { private: string company, report;
[Code] ....
Here are the errors: Error1error LNK2028: unresolved token (0A0003C9) "public: __thiscall Heading::Heading(void)" (??0Heading@@$$FQAE@XZ) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)c:UsersOwnerdocumentsvisual studio 2012ProjectsClassLibrary2ClassLibrary2Source1.objClassLibrary2
The following code writes to a file on either local disk to a remote disk (commented out code) on Windows 7 platform.
Code: #include <iostream> #include <fstream> using namespace std; int main () { ofstream outfile;
[Code].....
The documentation does not specify what is a valid filename (path and filename). For example, will the "\server emp" path work on all operating systems to access a samba share? Does the constructor accept forward and backward slashes as folder separator on all operating systems?
How can I write my simple program so if the user enters an invalid number, The program won’t exit? I know I am supposed to use a if (cin) or if (!cin),
But I don’t know where in the program or how I should use it. Right now my Program looks kind of like this:
If (number > 1 && number < 1001) Go through some function loops Else Cout << “invalid number”;
I need to write it so when the user enters an invalid number, the program would Keep asking for the right number until it's given.
So my program is to check if a certain 9x9 sudoku grid is valid. i have to get the input through command argument. so for example.
./a.out sudoku.txt
So we have make my c program to use FILE I/O open and what not
program behavior must be as follow File does not exist.File contains something other than a sequence of 81 integers (too many, too few, non-int).
One or more of the values is not in the range 1..9 Violation of Sudoku rules (this is the big one!) In case 4, you should report the violation (or any one of the violations if there are multiple -- you do not need to exhaustively enumerate all violations).
For example: Row Violation: entries (2,2) and (2,6) are both equal to 7. (Similarly for column and box violations). All i know is that i need to make a 2d 9 by 9 array
Is this a good way of writing this program?I wanted to start fresh with my new code though and a better title.Basically, I took what I learned from my questions in that thread and managed to build a list of musical notes( octaves, frequencies, sharp symbols, basically everything ).
Code:
#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <math.h> #define MAX_NOTES 88 /* 88 keys on a standard piano */
[code]...
I already know the frequencies are correct( they are rounded, but they should be close enough to the value ), but I wasn't so sure about the note labels. Obviously though, I'm not done with this program and I will be adding most of the functions Anduril suggested to take a text file and convert it into music. I just wanted to make sure I had everything correct before moving on. I probably didn't do the GetNextOctave() and GetNextNote() functions very efficiently so need suggestions on those functions also.
I have this piece of code in parts of my path finding algorithm
for( int head; head < q.size(); ++ head ){ walk& w = q[head];
// do manything with w if( some_condition ) q.push_back( walk( w.x + 1, w.y, head ) ); }
However I notice that sometimes w is cannot be dereferenced. It can but it throws junk number at me. Perhaps the vector is changing it size and move the whole array to a different location. Is there anyway to make sure that w is always valid ?
I just want to use w because of shorter typing and cleaner look not because of performance. I also refrain from using macro.
How can I write my simple program so if the user enters an invalid number, The program won’t exit? I know I am supposed to use a if (cin) or if (!cin), But I don’t know where in the program or how I should use it. Right now my Program looks kind of like this:
If (number > 1 && number < 1001) Go through some function loops Else Cout << “invalid number”;
I need to write it so when the user enters an invalid number, the program Would Keep asking for the right number until it's given.
if I include iostream twice in my project why is that valid? Wouldn't the linker see that there are two definitions of it and report a error, but it works?
After executing the first codeline strTempW.Format(L"%c", 0xFFFF), I will get strTempW of length 1, but cannot see it first character in Visual Studio watch window.
After executing the codelilne strTemp1 += strTempW, I will get strTemp1 of length 0.
Whether 0xFFFF is taken as a valid Unicode or not?
My errors are at the end of the program in two function calls within the definition of the InsertByValue function. g++ does not seem to recognize NumArray as a valid parameter.
#include <iostream> #include <assert.h> using namespace std; const int CAPACITY = 20;
/* Displays the content of an int array, both the array and the size of array will be passed as parameters to the function @param array: gives the array to be displayed @param array_size: gives the number of elements in the array */ void DisplayArray (int array[], int array_size);