Roshan
Of x
I guess it's not a function
Ahmet
What is setPosition()
A setter function
Roshan
A setter function
Check the way it's written
Roshan
Is there some way to write: player1.setPosition().x = 55;
SetPosition().x = 55; not setPosition(55);
Hadaward 'Solly'
:T
olli
Is there some way to write: player1.setPosition().x = 55;
if you implement the classes yourself, yes of course. If you're using SFML and calling setPosition on an object of type RectangleShape, no. All overloads return void.
Hadaward 'Solly'
olli
So what is setPosition() is it a function?
yes, it is. the available overloads are void setPosition (float x, float y); void setPosition (const Vector2f &position); You can check the documentation here https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1RectangleShape.php
The
/get
The
/get c books
olli
I see... It is some const vector2<float>& setPosition() const;
to be able to write x.setPosition().x = 123; you would need a function Vector2f& setPosition(); Why don't you use the existing functions?
olli
You mean, to write player1.getPosition().x = 123; 😅
no, that does not work since getPosition returns a const reference something like this auto pos = player1.getPosition(); pos.x = 123; player1.setPosition(pos);
Hadaward 'Solly'
he needs to read on references and indirection urgently
Anonymous
I need some opinion on directing cout output to a text file std::list<CString> listFiles; FindFiles(_T("D:\\"), _T(".txt"), listFiles); for (const auto& strFile : listFiles) std::cout << strFile.GetString() << std::endl;
Pest Control Service
u hv better option than redirect stdout
Anonymous
are you trying to join all the txt files into 1 big file?
No, my program shifts through all txt files and prints their address with their name.
Anonymous
can someone show me how to declare an array of intergers
Anonymous
Pavel
C
Something like this should work (I don't program in C, not 100% sure). int array_name[20]; or const int N = 20; int array_name[N];
rishin
#include<conio.h> int max(int n, int n2) { int result: if (ni>n2) result=ni; else result=n2: return result: Run Compile Debug NONAME01.CPP } void main() { int a=100,b=200,ret; ret=max(a,b); printf (ax is ",ret); getch();
rishin
can somebody help
Sag
can somebody help
int max(int n ,int n2) ; inside this arguments are formal argument
Anonymous
@rishin @pavel 🤝
rishin
int max(int n ,int n2) ; inside this arguments are formal argument
thank you..and which is the actual argument is it the same
Sag
thank you..and which is the actual argument is it the same
ret=max(a,b); argument inside function call
rishin
i read parameter list in function declaration is actual argument so got confused
Anonymous
Hello
Anonymous
include <stdio.h> int main() { int n, rev = 0, remainder; printf("Enter an integer: "); scanf("%d", &n); while (n != 0) { remainder = n % 10; rev = rev * 10 + remainder; n /= 10; } printf("Reversed number = %d", rev); return 0; }
Anonymous
#include<stdio.h> #include<conio.h> void main() { int n,sum=0; printf("Enter n value"); scanf("%d",&n); for(int k;n!=o;n=n/10) { k=n%10; sum=sum+k; printf("sum of the digits =%d",sum); getch(); return 0; }
Anonymous
Not my own code
Igor🇺🇦
Code from book
And what exactly don't you understand? Who studies from that uses turbo C++ these days anyway?
Roshan
Why
There is o instead of 0
Roshan
Explain this code
It was supposed to find the sum of digits of a number
Hoseini
Hi guys I'm new to programming world And I wanna start with C++ Have you got any advice for me? I would be so grateful for some piece of advice How to start and ...
Anonymous
Hii guys I’m an Italian student struggling for a a test could you help me??
Hoseini
Logic development
Is that the most important thing?
The
Logic development
How to develop...?? Bro
Roshan
Hoseini
Practice 😑
Things like solving math issues?
Hoseini
Any better interesting way? 🙁
Anonymous
Please guys 10 $ PayPal
Arthur
Things like solving math issues?
What's the difference between math problems and math issues?
Hoseini
What's the difference between math problems and math issues?
people sometimes prefer to use the word issue rather than problem, as it sounds more neutral and less negative
Arthur
"math issues" sounds like "a problem in the code related to math"
Hoseini
Sorry I couldn't get it😕🤦‍♂
Arthur
"math problems" sounds fine
Hoseini
"math problems" sounds fine
Now I get what you saying
Hoseini
👍
christian
1) Those are IDEs 2) Those are bad ones
I don't find them as bad
christian
#include<stdio.h> #include<conio.h> void main() { int n,sum=0; printf("Enter n value"); scanf("%d",&n); for(int k;n!=o;n=n/10) { k=n%10; sum=sum+k; printf("sum of the digits =%d",sum); getch(); return 0; }
#include<stdio.h> #include<conio.h> int main() { int n, sum = 0; printf("Enter n value"); scanf("%d",&n); for(int k; n != 0; n= n / 10) { k = n % 10; sum = sum + k; } printf("sum of the digits = %d",sum); getch(); return 0; } This is the correct code
.
can anyone help me out i nwed a visual basic project
Igor🇺🇦
can anyone help me out i nwed a visual basic project
This is C++ group, not Visual Basic one
.
sorry asking in case someone have any
Igor🇺🇦
sorry asking in case someone have any
Mainstream Support for Microsoft Visual Basic 6.0 ended on March 31, 2005. You don't start a new project in this language.