int main(){
	double x=3., y= 17.5;
	double w, z;

	w = function1(x,y);		// Call
	z = function1(y,w);		// Another call
	return 0;
}
Ejemplo n.º 2
0
float dichotomy_Function(float a,float b)//提前判定好function1(a)*(b)是异号的
{
    float x=0.0;
    x=(a+b)/2;
    if(function1(a)*function1(x)<=0)b=x;
    else a=x;
    if(b-a<0.1){
          return x;
    }

    else return dichotomy_Function(a,b);
}
Ejemplo n.º 3
0
int _tmain(int argc, _TCHAR* argv[])
{
	{
		Test obj1(10);
		obj1.ShowData();

		cout << "Adress of object: " << &obj1 << endl;

		Test obj2(obj1);
		obj2.ShowData();
		cout << "Adress of object: " << &obj2 << endl;

		Test obj3 = obj1;
		obj3.SetData(777);
		obj3.ShowData();
		cout << "Adress of object: " << &obj3 << endl;

		cout << "====================================\n";
		function1(obj1);
		obj1.ShowData();
	}
	{
		cout << "====================================\n";
		Test obj4 = function2();
		obj4.ShowData();

	}
	system("pause");
	return 0;
}
Ejemplo n.º 4
0
int main(void) 
{
  function1();
  function2();
  
  return(0);
}
Ejemplo n.º 5
0
int main(int argc, char *argv[])
{
	if(argc==1) 
    {
        printf("You must enter function\n");
        exit(1);     
    }
    char *fn_name;
    fn_name=argv[1];
    if(strcmp(fn_name,"function1")==0) function1(); //basic pointer aritmetic
    else if(strcmp(fn_name,"iscale")==0) iscale(--argc, ++argv); //generate E.T tables for N-notes to the octave (N<=24) ***NOTICE --argc and ++argv
    else if(strcmp(fn_name,"expdecay")==0) expdecay(--argc, ++argv); //generate exponential attack or decay breakpoint data
    else if(strcmp(fn_name,"sinetext")==0) sinetext(--argc, ++argv); //generate sinusoidal curve for use with GNUplot --> showcases use of enum
    else if(strcmp(fn_name,"byte_order")==0) { if(byte_order()==0) printf("System is big-endian\n"); else printf("System is little-endian\n"); } //tells endian type of system
    else if(strcmp(fn_name,"sf2float")==0) sf2float(--argc, ++argv); //convert soundfile to float format
    else if(strcmp(fn_name,"sig_gen")==0) sig_gen(--argc, ++argv); //generate oscillation signal (sine, triangle, square, sawtooth up, sawtooth down)
	else if(strcmp(fn_name,"osc_gen")==0) osc_gen(--argc, ++argv); //Oscillator Bank (Array of oscillators) for additive sythesis for the natural specturm of sound (classic square, trianlgle, saw_up, saw_down)
	else if(strcmp(fn_name,"summation_function")==0) summation_function(--argc, ++argv); // summation for a^n (CS473 Quiz3)
	else if(strcmp(fn_name,"secant_method")==0) secant_method(--argc, ++argv); // secant method implementation for CS357 Quiz3
	else if(strcmp(fn_name,"oddSumTest")==0) oddSumTest(--argc, ++argv); // oddSum program for Rishi
	else if(strcmp(fn_name,"pointerTest")==0) pointerTest();//pointer test for CS241
	else if(strcmp(fn_name,"aQRec")==0) aQRec(); //tests for audioQueueRecorder
    else
    {
        printf("Function not found\n");
        exit(1);
    }
    
    return 0;
}
Ejemplo n.º 6
0
void RunGame(void)
{
	int a=10;
	int b=20;
	function1(a);
	printf("%i", b);
}
Ejemplo n.º 7
0
void 
function2() {
  int i, j; 
  function1(); 
  for (i = 0; i < 200000; i++) 
    j = i; 
} 
Ejemplo n.º 8
0
void function(void) 
{
		key_diy();
		switch(key_status)
		{
			case 1:
				function1();
				break;
			case 2:
				function2();
				break;
			case 3:
				function3();
				break;
			case 4:
				function4();
				break;
			case 5:
				function5();
				break;
			case 6:
				function6();
				break;
			case 7:
				function7();
				break;
			default:
				function0();
				break;
		}
	
	
}
Ejemplo n.º 9
0
int main()
{
    char temp_buff[2140];
    sprintf(temp_buff,"This is a string %s:%d\n",__FUNCTION__,__LINE__);
    function1(temp_buff,"ENTER");
    return 0;
}
Ejemplo n.º 10
0
double call_function(int function,double arg){
	if(function==1){return function1(arg);}
	if(function==2){return function2(arg);}
	if(function==3){return function3(arg,0.5);}//using 0.5 for the elliptic modulous
	//should never get here
	printf("Unsupported function number: %d\n",function);
	exit(2);
}
Ejemplo n.º 11
0
int main()
{
long long x=function1();
printf("TIME(0) is %lld SECONDS \n",(long long)time(0));
printf("Realtime is %lld MICROSECONDS \n",x);
//secs = 1391340826
//usecs = 1391340826323473
}
Ejemplo n.º 12
0
int dltest(const char *s)
{
    printf( "libtest1: function1 = %p\n"
	    "libtest1: function2 = %p\n",
	    function1, function2);
    function1();
    function2();
    return(libtest2_func(s));
}
Ejemplo n.º 13
0
int libtest2_func(const char *s)
{
    printf( "libtest2: function1 = %p\n"
	    "libtest2: function2 = %p\n",
	    function1, function2);
    function1();
    function2();
    return 0;
}
Ejemplo n.º 14
0
void function1(char * buf, int counter)
{
  if (counter > 0)
  {
    function1(buf, counter - 1);
  }
  /*  BAD  */
  buf[4105] = 'A';
}
Ejemplo n.º 15
0
int main ( int argc, char * argv [ ] )
{
	x = 0 ;

	function1 ( ) ;
	function2 ( ) ;

	return 0 ;
}
TEST(FunctionalTest, MemberFunctionBind)
{
    A a(10);
    Function<int ()> function1 = bind(&A::f, &a);
    ASSERT_EQ(10, function1());

    Function<int ()> function2 = bind(&A::addF, &a, 15);
    ASSERT_EQ(25, function2());
}
main()
{
  char array1[10]="987654321";	/* one less so the \0 will fit  */

  function1(array1);		/* call function		*/

  printf("%s\n", array1);	/* O/P the altered array. '5' will
				 * have been changed to 'x'     */
}
Ejemplo n.º 18
0
int main(int argc, char *argv[]) {

    // Call the functions

    function1();
    printf("Function 2: %d\n", function2());
    printf("Function 3: %d\n", function3(2, 3));

    return 0;
}
Ejemplo n.º 19
0
int main(int argc, char *argv[])
{
  char buf[10];


  function1(buf, 3);


  return 0;
}
Ejemplo n.º 20
0
/*Goal: To call a specific function when a certain integer was the input. 
  Problem: There was no break statement at the end of each case, without a break statement, the default statement is always 
  printed out.
*/
void Problem13(){
	int i;
	...
	scanf("%d",&i);
	switch(i) {
		case 1: function1();break;
		case 2: function2();break;
		default: printf("Unknown command.\n"); break;
	}
}
Ejemplo n.º 21
0
int main()
{
	int a;
	float b;

	function1('c', 1);
	a=function2(1, 1);
	b=function3('c', 'c');

	return 0;
}
Ejemplo n.º 22
0
int function1(int counter)
{
  if (counter > 0)
  {
    return function1(counter - 1);
  }
  else
  {
    return 17;
  }
}
Ejemplo n.º 23
0
int main(){
	
	int num[10]={0};
	int next_number[10] = {0};
	int temp;
	int user_num, range;
	int i,remainder;
	int number;
	
	printf("Hi,Enter any number you want : ");
	scanf("%d",&user_num);
	
	//whole number is separated
	temp = user_num;
	i = 9;
	while(temp != 0){
		remainder = temp % 10;
		temp = temp/10;
		num[i] = remainder;
		i--;
	}
/*	range = i;
	//printf("%d",range);
	
	for(i = 0; i < range ; i++)
	{
		next_number[i] = num[(range-1)-i];
	}
*/	

	//printing in words
	for(i = 0 ; i < 10; i++)
	{
		
		
		if(i == 0 || i == 2 || i == 3 || i == 5)
		{
			printf("%s ",function1(i));
		}
		
		else if(i == 1){
			printf("%s",function3(i));
		}
		
		else if(i== 2|| i == 4 || i == 6)
		{
			printf("%s",function2(i));
		}
		
	}
		
	return 0;	
}
Ejemplo n.º 24
0
int main(int argc, char** argv)
{
	short a = 30;
	b = 31;
	int d = 33;
	
	printf("main() start:\n");
	printf("\ta => %d\n\tb => %d\n\tc => %d\n\td => %d\n",
		a, b, c, d);
	
	function1(34);
	function2();
	
	{ // block1
		long a = 40;
		b = 41;
		int c = 42;
		
		printf("main() block1:\n");
		printf("\ta => %d\n\tb => %d\n\tc => %d\n\td => %d\n", 
			a, b, c, d);
		
		for (c = 0; c < 1; c++)
		{// block2
			int a = 50;
			int d = 53;
			
			printf("main() block2:\n");
			printf("\ta => %d\n\tb => %d\n\tc => %d\n\td => %d\n",
				a, b, c, d);
			
			function1(54);
			function2();
		}
	}
	
	printf("main() end:\n");
	printf("\ta => %d\n\tb => %d\n\tc => %d\n\td => %d\n",
		a, b, c, d);
}
Ejemplo n.º 25
0
int main()
{
	int i,j;
	for(i=0;i<100;i++)
	{
		function1();
	}
	for(i=0;i<50000;i++)
	{
		function2();
	}
	return 0;
}
Ejemplo n.º 26
0
int 
main(int argc, 
    char **argv) {
  int i, j; 

  for (i = 0; i < 100; i++ ) 
    function1(); 

  for (i = 0; i < 500; i++)
    function2(); 

  return 0; 
}
Ejemplo n.º 27
0
float dichotomy_Function(float a,float b)//提前判定好function1(a)*(b)是异号的
{
    float x=0.0;
    if(b-a>=0.000005){
        x=(a+b)/2;
       // printf("a=%f b=%f x=%f\n",a,b,x);
        if(function1(a)*function1(x)<=0){
            b=x;

        }

        else {
            a=x;

        }
    dichotomy_Function(a,b);

    }
else
    return (a+b)/2;

}
Ejemplo n.º 28
0
void main( void ) 
{ 
    int data; 
 
    data = 2; 
 
    if (data == 2) 
    { 
        printf("Data is now equal to 2\n"); 
        data = 3; 
        data = function1();
    }
} 
Ejemplo n.º 29
0
TEST(tutorial_DeathTest, simpletest) {   // Convention: test case name should end with "DeathTest"
										 // DeathTests usually need to be run before other test
	int x = 90;

	// Reasons of death:  
	//    1. Process exited with non-zero code 
	//    2. Process was killed by a signal

	EXPECT_DEATH(function1(), "Bad thing happened");

	EXPECT_EXIT(function2(), ::testing::ExitedWithCode(22), ""); // "" means I don't care about cerr message

	//EXPECT_EXIT(function2(), ::testing::KilledBySignal(SIGKILL), ".*");  // Not on Windows
}
Ejemplo n.º 30
0
int main(){
        #pragma omp sections 
	{
                #pragma omp section
                    function1();
                
                #pragma omp section
                	function2();
               
                #pragma omp section
                  	function3();
    }
	return 0;
}