Dyskusje Q&A
"time is not defined"?
2 głosów
1 OdpowiedźConstructor Error
1 Głos
2 odpowiedziCan someone explain this code to me....
class ReverseNumberDemo
{ public static void main(String args[]) {
int num=123456789;
int reversenum =0;
while( num != 0 ) {
reversenum = reversenum * 10;
reversenum = reversenum + num%10;
num = num/10; }
System.out.println("Reverse of specified number is: "+reversenum);
}
}
the thing I don't get is the reversenum part......isn't reversenum=0 so wouldn't reversenum*10=0
0 głosów
8 odpowiedzican anyone plz explain me this program step by step?#include <iostream>
using namespace std;
class MyClass {
public:
int var;
MyClass() { }
MyClass(int a)
: var(a) { }
MyClass operator+(MyClass &obj) {
MyClass res;
res.var= this->var+obj.var;
return res;
}
};
int main() {
MyClass obj1(12), obj2(55);
MyClass res = obj1+obj2;
cout << res.var;
}I am not getting the part inside operator+
0 głosów
8 odpowiedziwhere's the error ?
-3 głosów
2 odpowiedziObjects in heap?
0 głosów
1 OdpowiedźWhy is not working
0 głosów
3 odpowiedziWrite a program to return the area of Geometricshapes square and rectangle. Area of square is side*side, rectangle is length*breadth. The controlling class should display the following menu and respond to the user’s selection
Mean
1. Calculate area of square
2. Calculate area of rectangle
3. Quit
Enter your choice (1-3):
0 głosów
3 odpowiedziPopularne dzisiaj
Countdown Test
1 Votes
diary
1 Votes
Could anyone fix this?
0 Votes
how do i create a code
0 Votes
Leecode?
2 Votes
Fitting
0 Votes
Module quiz not opening
1 Votes