View Single Post
Join Date: Nov 2008
Posts: 2
Reputation: Hassan87 is an unknown quantity at this point 
Solved Threads: 0
Hassan87 Hassan87 is offline Offline
Newbie Poster

Re: Need some help for a randomize code

 
0
  #2
Nov 12th, 2008
Here are my functions

1- To count even numbers

#include "stdafx.h"
int evens (int x)
{

	if (x%2==0)
		{
			x=1;
		}
		else 
		{
			x=0;
		}
	return x;
}



2- To count numbers higher than 28

#include "stdafx.h"
int highs (int x)
{

	if (x>28)
		{
			x=1;
		}
		else 
		{
			x=0;
		}
	return x;
}


3- To count numbers from level1

#include "stdafx.h"
int level1(int x)
{

	if (x<10)
	{
		x=1;
	}
	else
	{
		x=0;
	}
	return x;
}


4- To count numbers from level2

#include "stdafx.h"
int level2(int x)
{

	if (x>9 && x<20)
	{
		x=1;
	}
	else
	{
		x=0;
	}
	return x;
}

5- To count numbers from level3
#include "stdafx.h"
int level3(int x)
{

	if (x>19 && x<30)
	{
		x=1;
	}
	else
	{
		x=0;
	}
	return x;
}
		


}


6- To count numbers from level4
#include "stdafx.h"
int level4(int x)
{

	if (x>29 && x<40)
	{
		x=1;
	}
	else
	{
		x=0;
	}
	return x;
}


7- To count numbers from level5
#include "stdafx.h"
int level5(int x)
{

	if (x>39 && x<50)
	{
		x=1;
	}
	else
	{
		x=0;
	}
	return x;
}



8- To count numbers from level5

#include "stdafx.h"
int level6(int x)
{
	if (x>49 && x<56)
	{
		x=1;
	}
	else
	{
		x=0;
	}
	return x;
}



and for the libraries I added those under "stdafx.h":

#include <iostream>
#include <ctime>
using namespace std;
Reply With Quote