Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobierenF&A Diskussionen
Constructor Error
1 Stimme
2 AntwortenCan 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 Stimmen
8 Antwortencan 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 Stimmen
8 AntwortenIn dire need of tutoring or help
0 Stimmen
2 AntwortenStyling Swing Components in java
0 Stimmen
2 Antwortenwhere's the error ?
-3 Stimmen
2 AntwortenData Members and Member functions
-1 Stimme
1 AntwortObjects in heap?
0 Stimmen
1 Antwort"id returned 1 exit status"?
1 Stimme
1 AntwortBinary search guessing game help
0 Stimmen
1 AntwortHow to use inner classes on java
0 Stimmen
2 AntwortenWhy is not working
0 Stimmen
3 AntwortenWrite 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 Stimmen
3 AntwortenLinked list questions, part 3
0 Stimmen
3 Antwortenusing System;
namespace GoodProgrammerTest
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter Yes or No");
Console.Write(
"Do you programme every day? : ") ;
int answer = Console.ReadLine();
if (answer =="Yes")
{
Console.WriteLine(
"You will be a good programmer");
}
else
{
Console.WriteLine(
"You will not be a good programmer");
}
}
}
}
2 Stimmen
3 Antwortencan someone please explain why this code keeps telling me complication error instead of outputting the value of speed.
#include <iostream>
using namespace std;
class myClass {
public:
void setcarspeed (int a){
speed=a;
}
int getcarspeed(){
return speed;
}
private:
int speed;
};
int main() {
myClass obj;
obj.setcarspeed (40);
cout<<obj.getcarspeed ;
return 0;
}
2 Stimmen
3 AntwortenWhile prototyping friend functions in a class is it necessary to always pass the address of the object as parameter?If so why is it that we have to pass address as parameter..In programs involving compositions we never used addresses...Why is the need for address of the objects while using friend?
4 Stimmen
1 AntwortHeute heiß
Access deny problem
2 Votes
3 consecutive words
0 Votes
c++ help
0 Votes
BOTSS
0 Votes
A small question
0 Votes
Help
0 Votes
How to use ai ?
0 Votes
What's wrong with my code?
0 Votes