Posts by Artur dantas • 65 points
7 posts
-
0
votes0
answers16
viewsQ: What Are C++ Pointers For?
I am studying C++ for about 3/4 weeks, and I always look for some exercises to practice and in several of these exercises I end up encountering Ponteiros. From what I know so far they store the…
-
-2
votes1
answer41
viewsQ: How to create optional parameters in C++?
In Python it is possible to have optional parameters in a function. It would look something like this: def soma(n1, n2 = 5): return n1 + n2 print(soma(5, 7)) If a second parameter is not passed n2…
-
1
votes2
answers46
viewsQ: How to iterate over a string by obtaining the indices of each character in C++?
Example done in Python: editor = 'Luiz' for contador, letra in enumerate(editor): print(f"A letra '{letra}' está no índice {contador} ") I was wondering if it’s possible to do this kind of counter…
-
0
votes1
answer53
viewsQ: How to convert an entire string to uppercase characters without using loop?
I have the following code: #include <iostream> #include <ctype.h> using namespace std; int main() { string nome = "pedro", up; for (int n = 0 ; n != nome.length(); n++) { up +=…
-
2
votes1
answer68
viewsQ: "strlen()" works with literal but not string type variable
I have this code: #include <iostream> #include <string.h> using namespace std; int main() { int len = strlen("Teste"); cout << len << endl; return 0; } That generates the…
-
3
votes2
answers84
viewsQ: How to return the last character of a String in C++?
I want to make a program that shows on the screen the last character of a String. In Python it would be something like this: nome = "Teste" print(nome[-1]) Upshot: and So I tried to adapt it to C++:…
-
-1
votes1
answer32
viewsQ: Problems with print in python socket
I’m already hours away trying to solve this error, well... in the python socket I made a program in which the client sends his name and the program picks up the IP and the date and time that he sent…