Hi guys :)
I have small question of course I don't want to ask for solving my homework, no i'll work on it on my own.
I just need some tips :) please.
I want to make a program that calculate these function:
F1 = 1;
F2 = 2*lgn + 2;
F3 = 2*n + 2;
F4 = 2*n*lgn + 2;
F5 = 2*n^2 + 2;
F6 = 2*(n!) + 2;
F7 = 2*(2^n) + 2;
for these values: (replace "n" with these values)
array[7] = {0,1,2,3,4,5,6}
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
my question is, how should I write the could so that it'll replace "n" with "0,1,2,3,4,5,6" and get the result for each integer from that several functions.
Also, what should I write instead of "lg n"? I meant if I wrote in C++ "lg n" it won't understand that!!!
Thanks in advance..
This is my code at the moment
// Mohammed Aldhaferi
// 205112766
// Program that compute the value for some integers in several functions such as (1, log n, n...etc).
#include <iostream> // input\output stream.
#include <cmath> // To be able to use Math Library.
using namespace std; // This command will help us to not write "std::" all the time.
int main()
{
int array[7] = {0, 1, 2, 3, 4, 5, 6}; // Initiating an array of size 7, of type integer.
float F1, // Creating these
F2, // variables
F3, // to
F4, // assgin to
F5, // them
F6, // the functions
F7; // we want.
cout << "We'll have these following functions:\n";
cout << "F1 = 1\nF2 = 2*logn + 2\nF3 = 2*n + 2\nF4 = 2*nlogn + 2\nF5 = 2*n^2 + 2\nF6 = 2*(n!) + 2\nF7 = 2*(2^n) + 2\n\n";
/*F1 = 1;
F2 = 2 * logn + 2;
F3 = 2 * n + 2;
F4 = 2 * n * logn + 2;
F5 = 2 * ( pow(n, 2) ) + 2;
F6 = 2 * (n!) + 2;
F7 = 2 * ( pow(2, n) ) + 2;*/
// Output the head of the table we want to create.
cout << "no. " << "F1 " << "F2 " << "F3 " << "F4 " << "F5 " << "F6 " << "F7 ";
for( int i = 0; i < 7; i++ )
{
}
return 0; // to indicate successfully termination.
} // end function main.