• Register

Recent questions tagged function

0 votes
0 answers 2 views
In this code : def __repr__(self):   return '<%s %s (%s:%s) %s>' % (     self.__class__.__name__, self.urlconf_name, self.app_name,     self.namespace, self.regex.pattern) What is the significance/purpose of def__repr__(self) ?
asked 2 days ago psandprop 1.4k points
0 votes
1 answer 8 views
Problem: I am new to the world of programming and I am learning functions in C#. While working with functions, a question popped in my mind that whether I can pass function to another function as parameter or not? I tried doing so, but nothing worked. So, my question is: can I pass a function to another function as a parameter? If yes, how? if not, why?
asked 3 days ago Sheeza 2.9k points
0 votes
1 answer 2 views
Problem: I am working with functions in C++. I am encountering an error that say &ldquo;not all code paths return a value&rdquo; while calling the following function: public static int divide(int a, int b) { int div = a / b; Console.Write(div); } I have no idea whats happening. How to resolve the error and why is occuring??
asked 3 days ago Sheeza 2.9k points
0 votes
1 answer 9 views
0 votes
1 answer 5 views
asked 6 days ago SapperIt 1.2k points
0 votes
1 answer 4 views
Problem: Hi there, I am making a calculator in C# Windows Forms Application in which I take 2 numbers as input from user in textboxes, but everytime the user enters a number, the program throws and exception and my calculator does not work. I read on Google that the text ... order to do so I tried using if statement with Convert.ToInt32() method but it does not work. Please guide what I can do?
asked Oct 15 Sheeza 2.9k points
0 votes
1 answer 5 views
Problem: Hi there, I am a noob and recently while studying functions I came across the following program that created confusion in my mind: #include<iostream> using namespace std; void add(int a, int b) { cout<<"The sum of "<<a<<" and "<<b<<" is "<<a+b; } ... ,5,6); return 0; } First of all, why are all the functions named as add? Secondly, how does the compiler identifies which function to call?
asked Oct 14 Sheeza 2.9k points
0 votes
1 answer 9 views
0 votes
1 answer 9 views
0 votes
1 answer 7 views
Problem: Can member functions be constant in C++? If yes, then what is the purpose of constant member functions and how do we declare, define and use them?
asked Oct 14 Sheeza 2.9k points
0 votes
1 answer 6 views
0 votes
1 answer 13 views
asked Oct 14 softwere engineer
0 votes
1 answer 9 views
Problem: Hello, I am learning functions with parameters in c++ and want to know how can I pass an array to a function in c++?
asked Oct 14 Sheeza 2.9k points
0 votes
1 answer 7 views
Problem: I am working with classes in C++ and trying to access a function that is private but continuously failing to do so. How can we access private member functions?
asked Oct 13 Sheeza 2.9k points
0 votes
1 answer 9 views
I created my first php class. I have two methods in this class. One was to initialize the colors and the other was to return the selected color. But my code encounters this error: &ldquo;Invalid argument supplied for foreach()&rdquo;. Please help. class MyColors { private $colors=array(); function __construct( ... , array('id' => 4, 'color' => 'white'), array('id' => 5, 'color' => 'yellow') ); } }
asked Oct 11 dorothy 180 points
0 votes
1 answer 5 views
I want to know how to call to an overloaded function be ambiguous.
asked Oct 4 Daniel Anderson 4k points
0 votes
1 answer 13 views
I wonder if you could change the value of an external input variable that is treated as a function parameter, I remember seeing a way to do it but I don't remember very well. Suppose we use a function for the sum of two numbers, which has two parameters, the first ... of the sum =" << number << endl; The result of the sum should be stored in the variable. Would this procedure really work?
asked Oct 1 sasha 1.2k points
0 votes
1 answer 10 views
I have this code: int max1 (int a, int b) {int m = a;  if (b> m) {m = b;  } return m;  } int main () {cout<< max1 (5,6) <<endl;  cout<< main () <<endl;  return 0;  } I have wanted to test that code but am afraid my computer will be damaged. What happens if the main () function is called?
asked Oct 1 sasha 1.2k points