[Solved] Writing a function that calculates sine for inputted number of terms. MATLAB [closed]

found the answer myself.. note that there is a difference between sinx and sin(x) function [sinx, error] = sinx_approx(x) % approximates the value of sin(x), the approximation is more accurate as % the number of terms selected is increased. n= input(‘Up to how many terms would you like to evaluate?’); sinx=0; for i=1:1:n sinx=(-1)^(i+1) * … Read more

[Solved] How to set a matrix as a parameter to a function

You can represent the matrix as a vector<vector<int> >. Try something like this: #include <vector> using namespace std; void myFunction(const vector<vector<int> >& matrix) { // do something w/ matrix passed in… } int main() { // create a 3×4 matrix initialized to all zero const size_t rowCount = 3; const size_t colCount = 4; vector<vector<int> … Read more

[Solved] nested IF, AND, OR function compare and give result excel

Try this formula =MATCH(G5,{“Prica Plus”,”Miks S”,”Miks M”,”Miks L”,”Miks XL”,”Miks XL Plus”,”Miks XXL”,”Super”},0)-MATCH(F5,{“Prica Plus”,”Miks S”,”Miks M”,”Miks L”,”Miks XL”,”Miks XL Plus”,”Miks XXL”,”Super”},0) Above formula can be broken down in two parts. Firstly, matching Cell G5 to your values =MATCH(G5,{“Prica Plus”,”Miks S”,”Miks M”,”Miks L”,”Miks XL”,”Miks XL Plus”,”Miks XXL”,”Super”},0) Secondly, matching Cell H5 to your values =MATCH(F5,{“Prica Plus”,”Miks S”,”Miks … Read more

[Solved] How to pass a value from javascript function? [duplicate]

To communicate between javascript (which runs on the client machine’s browser) and PHP (which runs on your server) you need to use ajax. Since you are already using jQuery, I suggest using their abstraction method $.ajax(). It would look something like this: // post value of #progressbar id to my php page $.ajax({ url: myPHPPage.php, … Read more

[Solved] Built in function to compare strings in C++?

You could use std::string::compare() which provides the same functionality as strcmp(). std::string name1 = “John”; std::string name2 = “Micheal”; int result = name1.compare(name2); Would roughly be the same as: const char* name1 = “John”; const char* name2 = “Micheal”; int result = std::strcmp(name1, name2); solved Built in function to compare strings in C++?

[Solved] How to put an input in a function

You are never defining the function you’re trying to call. You’re printing from the function but never returning a value, thus your variable “a” will never get a value. Take a look at this, hopefully you’ll see where you went wrong: def odd(x): if int(x) % 2 == 0: return(“this number is even”) else: return(“this … Read more

[Solved] Javascript rock paper scissors project

Try this corrected and verified JavaScript Code – var rock = rock; var paper= paper; var snip = snip; var playerOneName= prompt(“what is your name”); playerOne = choice(); var playerTwoName = prompt(“what is your name”); playerTwo=choice(); alert(‘Player 1 Chose – ‘+ playerOne + ‘Player 2 Chose – ‘+playerTwo); function choice(pick){ return(prompt(“rock paper or snip”)); //return … Read more