help solve some exercise....


3. create a function with int parameter L that creates a dynamic array with L item like -8,-7,-6,0,2,4,6. the function will return the address of array that creates dynamical, unless the parameter L is equall or lower than 0 the will return false.

Last edited on
1. Here's what a function with parameters looks like:

1
2
3
4
5
6
7
int function(int x, int y)
{
     if(x > y)
          std::cout << "Black People";

     return 0;
}



2. I don't know what "ISD" is, it could be an acronym I haven't seen before or a class type. However, the logic is very simple. You'll make a function call based on an if/else statement.

3/4. Pretty much just making functions that do stuff. Try to have a go at it.


Once you have an actual question, you can post for help.
the ISD its a random name .
could u pls help me solve them because i have to give them tommorow morning
Last edited on
make a function with int parameter times

A function, whose name you can decide.
The function takes a parameter. The type of parameter is int and name is times.

call another function name "Perfect"

There is a function void Perfect(); that you must call multiple times -- in a loop.

parameter "ISD" ... if ISD is true

"ISD" is a name of parameter. Its value can be true or false. What type those values have?
did you change the question?! Please do not do that, it just makes the thread into nonsense.

1
2
3
4
5
6
7
 
int* foo(int L)
{
   if(L >0)
   return new int(abs(L));
   return nullptr; //== false 
}


honestly the question is no fun.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 
 //how about wiring it so negative indexing is ok?
 int* foo(int L)
{

   int *ip = new int(abs(L));
   if(L>0) return ip;
   if(L)  return &ip[abs(L)-1]; 
   return nullptr; //L was 0 here. 
}


 int main()
 {
   int * ip = foo(-10);
   ip[-9] = 11; 
   cout << ip[-9] << endl;
 }


*If you do the above silly thing you have to remember to back your pointer up to delete it later. But it was really just meant as a joke
Last edited on
Topic archived. No new replies allowed.