C# :: Can't Get Math (Sine) Function To Work

May 21, 2014

I'm having trouble with getting a sine function to work. All variables are defined earlier in the same section. I have the code in a button (where I figured it would go) but I get the following error:

WindowsFormsApplication2.Math does not contain a definition for 'Sin'

For reference, I am using Microsoft Visual Studio Express 2013, and am coding a Windows Forms Application.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;

[Code] ....

I've tried other functions as well (abs, sqrt, etc.) to no avail, as Math only seems to pop up with two options: Equals and ReferenceEquals.

View 2 Replies


ADVERTISEMENT

C/C++ :: Approximate Sine Function With Taylor Series

Dec 22, 2014

Write a C program with a separate function which calculates the sine function from the first principles according to the formula below. The code should find the sine value in 5 stages and then final answer

formula below :

sin(x) = x −x3/3!+x5/5!−x7/7!+x9/9!

I have done the code and it just gives me a final sine wave

it should find a error then plus one so on till it gets the answer

Link:

These are images of what it should look like and the image of a the formula ....

View 7 Replies View Related

Visual C++ :: Creating Program To Make Sine Function Without Any Library Other Than Iostream?

Nov 10, 2012

My assignment is to create a C++ Program to find the sine of a number without any library other than iostream by using Taylor Series:

sin (x) = (x/1!) - (x^3/3!) + (x^5/5!) - (x^7/7!) + (x^9/9!) ...... (x^n/n!).

Here is what i have done till now:

#include <iostream>
double fact (int f); //declaration of factorial function
double power(double x, int y); //declaration of power function
double sin(int x); //declaration of sine function
//double cos(int x); //declaration of cosine function
//double tan(int x); //declaration of tangent function

[code]....

View 3 Replies View Related

C/C++ :: Finding The Value Of Sin(x) Without Using Math Function

Apr 14, 2013

How can i solve a problem of sin(x) without using any math.h and only using my own declared function.

#include <stdio.h>
int fact (int a) {
    int i;
    int k = 1;
    for (i=1;i<=a;i++)

[Code] ....

View 3 Replies View Related

C :: Math Function Using Exponential Growth Formula

Sep 3, 2013

Its a basic math function using the exponential growth formula which is correct but the computer is not outputting the right numbers.

Code:
#include <stdio.h>
#include <math.h>
int main() {
int blanketsquares, num1, num2, blanket,remainder;

[Code] .....

View 6 Replies View Related

C :: Math Quiz Program - Multiplication Function

Nov 16, 2014

Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void correctResponse(void);
void incorrectResponse (void);
void multiplication( void ); // function prototype

[Code] ....

// end function multiplication

// It keeps crashing. How do I compile the responses into a grade?

View 5 Replies View Related

C :: Function That Will Work For Both Dynamic And Static Implementations Of A Function To Get Transverse Of Matrix

Feb 11, 2013

i need a function that will work for both dynamic and static implementations of a function to get the transverse of a matrix. so far, i have this

Code:

matrix transpose(matrix m)
{
int row, col;
row = m.com_dim;
col= m.row_dim;
}

[code]....

this works well with my static implementation, but when i try it in dynamic it gives me errors. the function has to be the same for both dynamic and static implementation

View 4 Replies View Related

C++ :: Template Function Don't Work As Inline Function?

Mar 8, 2014

I have this:

string input;
unsigned short choice;
...
istringstream valid(input);
...
if(!(valid >> choice))
{
//some error
}

Ok. My code is almost 1000 lines, and I have splited some functions in headers. But the same function doesn't work:

template <typename T> bool valid_input(const string& input, T var)
{
istringstream valid(input);
return (valid >> var);
}

You can check it here: [URL] The output is correct, but in my machine with C++11, MinGW 4.8 (64 bit in a 64bit-Windows8), the output is incorrect. Why?

If you want more specific info, the problem is that I use input, I think. I use std::getline(std::cin, some_string).

View 4 Replies View Related

C++ :: Print Function Does Not Work Properly

May 21, 2013

This is my code for submitting students but when i use search function the course member is empty

Code: #include "windows.h"
#include "iostream"
#include <io.h>
#include <sstream>
#include <conio.h>
#include <stdlib.h>
#include <iostream>
#define SIZE 5
using std::cout;
using std::cin;
using namespace std;
int menu();

[code].....

View 11 Replies View Related

C :: Qsort Function Won't Work Properly

Mar 20, 2013

i am facing some problem with qsort() function it work well if the last element of array is larger then the 2nd last element. But in case if last element of array is smaller then the 2nd last it will sort the whole array and remains the last as it is. For example

Code:
int group_id_local[max_j]={2,1,4,5};// it work fine, output should be {1,2,4,5} but if i have this one

int group_id_local[max_j]={2,1,4,3};
// output should be {1,2,4,3}
/* COMPARE FUNCTION FOR USING QSORT()*/
int cmpfunc (const void* a, const void* b)
{
if (*(int *)a < *(int *)b) return -1;
if (*(int *)a > *(int *)b) return 1;
return 0;

[Code]....

why it will not sort the last element?

View 5 Replies View Related

C++ :: Can A Friend Function Work For Two Classes?

Mar 23, 2013

If yes then how?

View 6 Replies View Related

C++ :: BST Node And Count Function Don't Work?

Dec 2, 2013

I have to do a BST project for school and I am almost there. Here is the code:

BINARY_SEARCH_TREE.cpp
#include "stdafx.h"
#include "genBST.h"
#include <iostream>
using namespace std;

[Code].....

When I run the program, it compiles correctly but does not give any output. I'm not sure what else to do. I've tried changing up the code in nodeCount(), leafCount(), NodeCount(), and LeafCount(). I've tried adding a count variable to both nodeCount() and leafCount() but that didn't work. If I fiddle with the functions, I get a whole mess of errors. Currently, the code is stable but just won't output what I want it to.

View 3 Replies View Related

C++ :: Make A Function Integrate To Work With Other Functions Given

Mar 10, 2013

We have to make a function integrate to work with the other functions given. I had it working before but I would only get all -4 as my answers but only the first one should be -4. what should more or less be put in my integrate function?

#include <iostream>
using namespace std;
typedef double (*FUNC)(double, double, double) = (line, square, cube);
double integrate(double FUNC, double a, double b){
for(int i=0; i<a && i<b; i++){
FUNC = a-b;

[code]......

View 2 Replies View Related

C++ :: Quicksort Function To Work With Class Array

Jan 19, 2013

void Quicksort(int info[],int left,int right){
int pivot = left + (right - left)/2;//it is the middle (will change sometimes but will end up in the middle
int temp;

while(left<=right){
while(info[left] < pivot){

[Code] ....

This is my quicksort function. I have tried a lot of things but I am trying to get it to work to sort all the details I have stored in an array by there age. This is how I have entered the data.

void DataEntry(Details info[],int size){
int x;
int i;
i=0;
cout << "How Many Entries Would You Like to add";

[Code] ....

I am stuck on what to do with it

View 18 Replies View Related

C :: Delete Each Element In The List Which Is Same - Function Does Not Work Properly

Jan 18, 2014

Code:

struct lista* del(struct lista* p, char* path1) {
char model[MAX2];
int len;
char ch;
printf("Type model.

[Code] ..... t

This function should delete each element in the list which is the same as this one typed by user. There are no errors, but function doesn't work. It deletes something, but not this element which should.

View 5 Replies View Related

C++ :: Convert QT String Manipulation Function To Work With Strings?

Feb 15, 2012

I have the following function I would like to convert to work with std:string. I don't understand QT strings at all.

Code:
void FromHexString(const QString &hexText, void* pData, int dataSize) {
for (int i = 0; i < hexText.length(); ++i) {
bool ok = false;
((uint8_t*)pData)[ i ] = hexText.mid( 2*i, 2 ).toInt( &ok, 16 );
}
}

View 1 Replies View Related

C++ :: Function To Count Digits Of Entered Number Doesn't Work

Feb 19, 2013

I wrote a program with function my own function which count the digits of entered number. The problem is whatever i type it shows 0 digits.Why is that?

Code:
#include <iostream>
using namespace std;
int cikCipari (int skaitlis, int cipars);
int main()

[Code] .....

View 7 Replies View Related

C++ :: Adding Void Function In Visual Studio 2012 Does Not Work

Mar 1, 2013

I am trying to add a void function in Visual Studio 2012 but it doesn't work, meanwhile in Codeblocks it does:

#include <iostream>
using namespace std;
int welcome();
int main(){
welcome();

[Code] ....

View 5 Replies View Related

C++ :: How To Calculate X And Y In Sine Wave

Apr 24, 2012

I have the following initial code:

Code:
double objectAngle = -90.0f;
double objectSpeed = 3.0f; // meters per second
double objectDistance = 300.0f;
double objectTime = 0.0f;
double objectHeading = 90.0f;
double elapsedTimePerCycle = 1.0f;

My coordinate system looks like this:

Code:
90 y
|
|
|
+-180 -------------------- 0 x
|
|
|
-90

I want to calculate a new x,y such that it follows a sine wave like pattern until it gets to point (0,0). I want the width of the arc to go out to about -45 degrees, and the same on the other side to about -135 degrees.

How can I compute these new x,y coordinates in C++?

View 14 Replies View Related

C++ :: Sine Wave Movement With The Saucer

May 4, 2014

I am currently working on an arcade game for my final assignment this year. I am struggling to get a sine wave movement with the saucer. Here is the code for it:

void ArcadeGame::spawnSaucer() {
Texture* pTexture = getTexture("saucertexture");
m_pSaucer = new GameObject(pTexture, "saucer");
m_pSaucer -> setPosition(1000, 300);
m_pSaucer -> setVelocity(-1, 10 * sin(1 * 3 * PI / 180), sin(1) * OBJECT_DEFAULT_SPEED);
addGameObject(m_pSaucer);
m_pSaucer->setSolid(true);
}

View 8 Replies View Related

C++ :: How To Create Multiple Sine Waves

Apr 21, 2014

#include <cstdlib>
#include <iostream>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include "dp_lib.h"
int main() {
int A =1;

[Code]...

im new to coding but ive written this code for an assignment and it creates 2 sine waves and adds them together but i want to be able to create a range of different sine waves at different frequencies and play them one after the other like in my code,but with the end result being that i would like each sine wave to represent a different note, so when your on the the console screen the user will be able to choose from a select number of notes and input them in any order so that the WAV file produced plays the sine waves in the order the user chooses so they can make a simple tune. but my code only plays it in the order it is in the code

View 8 Replies View Related

C++ :: Calculator Program - How To Do Sine Calculation

Apr 26, 2013

I am basically trying to make a program for a calculator. I am struggling with how to do the sine calculation. this calculation will take place at line 158.

#include <iostream>
#include <cmath>
using namespace std;
int main() {

double firstNumber = 0.0;
double secondNumber = 0.0;
char operation =' ';

[Code] ....

View 1 Replies View Related

C/C++ :: Creating Multiple Sine Waves

Apr 18, 2014

#include <cstdlib>
#include <iostream>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include "dp_lib.h"
int main() {
int A =1;
float* data;

[Code] ...

I am doing ive written this code that creates 2 sine waves and adds them together but my question is that im trying to write a code where i can create multiple sine waves assign each sine wave to a separate values (musical notes ie A B C) and then be able to add them together in any order to create a tune.

View 2 Replies View Related

C/C++ :: Sine Wave - Printing Files To Excel

Mar 7, 2014

I need to create a sinewave. I have the values in an Excel file. The code reads the excel file and prints the values in the cmd but I need it to print back into excel as a sine wave. Pretty sure its currently values for a triangle wave but whatever I want a wave before I care about the type.

Description: Creates an array of values of a triangle wave, prints the result to the screen and creates a CSV (comma separated variable) file of data points. Allows user to enter number of amplitude and number of cycles

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#define N_SAMPLES 1000 // crashes if array size > 1000?
#define UP 1
#define DOWN 0

[Code] ....

View 11 Replies View Related

C++ :: Trigonometry Programming - Solving Triangle By Using Cosine And Sine Law

Jun 3, 2013

I am writing a program to solve a triangle. Given any three pieces of information, find the other three. I am having trouble with SSA. I use the cosine law to find the unknown side. Then I use the sine law to find the other two angles. The sine law will give me each of the other angles. If one of the unknown angles is over 90 degrees, my program gives an angle as under 90 degrees. Not surprisingly, the correct angle and my wrong angle add up to 180 degrees. If you draw out the triangle you can deduce the right answer. How to have my program find out when the angle needs to be over 90 degrees.

View 5 Replies View Related

C :: Loop Does Not Work And Program Quits Without Displaying For Loop Function

Oct 13, 2014

We are making a program--but every time we input a value for scanf, the following for loop does not work and the program quits without displaying the for loop's function. We are not getting any errors.

View 11 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved