World Stream
But cwithme id a chainal not a group
World Stream
Is*
Avique
what is the Agent inside the Agent class? a constructor?
Yes, it should have been a constructor. I just missed the "( )" there. I read a basic book, but it did not help - the "detail" was invisible to me.
Anonymous
Need a personal instructor to help with college first semester coding . Preferably indian . Dm me if anyone wants to help . Thank you .
Anonymous
MRT
/warn no
MRT
:D
Akansha
Program to overload ++ operator to increment date
Anonymous
Program to overload ++ operator to increment date
goo.gl/search?Program+to+overload+%2B%2B+operator+to+increment+date
Anonymous
Program to overload ++ operator to increment date
/warn program not to misuse the telegram chat and a search engine
priya
The program is to print till the first non alphabet character My code is:
priya
#include<stdio.h> #include <stdlib.h> int main() { char a[1001]; scanf("%[A-Za-z0-9]s",a); printf("%s",a); } but only 4/11 test case passed I know that I can use isaplha but I just wanna know why my code didn't work could anyone help me out
Avique
Sometimes a teacher is needed
in theory, i know c++ well, but i had not used it directly since many years ago, and now i have a bit of dyslexia, which helped me (i guess) not seeing the silly mistake for a few days, and concluded it was another kind of problem - which is fairly common to me.
Bojan_Krdemn
https://pastebin.com/YFrgCzyN Hi! Can you criticize (evaluate) the algorithm here? Seems to work, but if anything
Bojan_Krdemn
long have i suffered to make it work , but finally it works though something distubs me
Apk
What do they consider in alphanumeric characters? Because some characters like & and @ are also considered alphanumeric
priya
What do they consider in alphanumeric characters? Because some characters like & and @ are also considered alphanumeric
yeah thanks for your previous reply it's actually only till alphabets.I'm Sorry
Anonymous
I don't actually know C++ and couldn't say if this has memory leaks or other badness. https://nekobin.com/tebukihota
World Stream
/warn no
Why are you warn me, this is not a snapping word
Simone
Guys Hi, I have a problem with C
Simone
coordinate * percorso(taxi *ts,coordinate arrivo, matrix *mat, int index){ int arrivato = 0; coordinate result[SO_HEIGHT*SO_WIDTHS]; result[0].x = -1; result[0].y = -1; int i = 0; while (!arrivato){ if(mat->mat[ts[index].init2.x+1][ts[index].init2.y].type != 'X' && ts[index].init2.x > 0 && ts[index].init2.x < arrivo.x){ result[i].x = ts[index].init2.x +1; result[i].y = ts[index].init2.y; i++; }else if(mat->mat[ts[index].init2.x][ts[index].init2.y+1].type != 'X' && ts[index].init2.y > 0 && ts[index].init2.y < arrivo.y){ result[i].x = ts[index].init2.x; result[i].y = ts[index].init2.y+1; i++; }else if(mat->mat[ts[index].init2.x-1][ts[index].init2.y].type != 'X' && ts[index].init2.x < SO_WIDTHS && ts[index].init2.x > arrivo.x){ result[i].x = ts[index].init2.x-1; result[i].y = ts[index].init2.y; i++; }else if(mat->mat[ts[index].init2.x][ts[index].init2.y-1].type != 'X' && ts[index].init2.y < SO_HEIGHT && ts[index].init2.y > arrivo.y){ result[i].x = ts[index].init2.x; result[i].y = ts[index].init2.y-1; i++; } result[i].x = -1; result[i].y = -1; if(ts[index].init2.x == arrivo.x && ts[index].init2.y == arrivo.y) arrivato = 1; } return result; } int contaPercorso(coordinate percorso){ int percorsoTot; int i = 0; int j = 0; for(i = 0;i<percorso.x;i++){ for(j = 0;j<percorso.y;j++){ percorsoTot+1; } } return percorsoTot; } void movimento_taxi(coordinate cord,coordinate cord2,matrix *mat,taxi *ts) { printf("SONO IN MOVIMENTO_TAXI \n"); printf("Taxi %d \n",getpid()); printf("Message received : 1x %d 1y %d and 2x %d 2y %d\n",cord.x,cord.y,cord2.x,cord2.y); int i = 0; int j = 0; int a = 0; taxi vicino; int trovato; while(!trovato){ int id; int a1 = 0; int a2 = 0; coordinate* per1[SO_HEIGHT * SO_WIDTHS] = percorso(ts, cord, mat,a); if(ts[a+1] != NULL){ coordinate per2[] = percorso(ts, cord, mat,a+1); a1 = contaPercorso(per1); a2 = contaPercorso(per2); } if(a1 < a2) { vicino = ts[a]; } } //printf("ID= %d (CHILD): PROCESSID=%d, Taxi creato coord : x %d y: %d\n",ts[a].ID, ts[a].processID,ts[a].init2.x,ts[a].init2.y); // Controllo quale è il piu vicino, salvo id taxi = ts[i]; //coordinate percorso[] = percorso(vicino, cord, mat, /*int id taxi vicino*/); // Da qui controllo sul percorso, celle libere ovvero ci sta il taxi for (i = 0; i < SO_HEIGHT; i++) { //printf("Taxi %d è qui\n",getpid()); for (j = 0; j < SO_WIDTHS; j++) { if(mat->mat[i][j].type == '1' || mat->mat[i][j].type == '2' || mat->mat[i][j].type == '3') { printf("Taxi %d è qui\n",getpid()); } } } printf("ESCO DA MOVIMENTO_TAXI \n"); //printf("semaforo unlocked %d \n",&sops); //UNLOCK; }
Anonymous
;-;
Chr
What is database admin utilities
Chr
How can we write in c language
Chr
Any one help me
Simone
I can't return result[] in method "percorso". I have an error here oordinate* per1[SO_HEIGHT * SO_WIDTHS] = percorso(ts, cord, mat,a); if(ts[a+1] != NULL){ coordinate per2[] = percorso(ts, cord, mat,a+1); a1 = contaPercorso(per1); a2 = contaPercorso(per2); } if(a1 < a2) { vicino = ts[a]; }
Simone
If I take result of percorso method I have error in; cordinate* per1[SO_HEIGHT * SO_WIDTHS] = percorso(ts, cord, mat,a);
Simone
Sry for very bad english
Simone
No idea what you're doing here, but you can return result* only
I'm creating a method for move a taxi in a map. I want to return the coordinate x and y of all calculated trip
Simone
So i can insert this value and move the taxi
Massi
Hello guys any tips for learning C and books to read?
Diego
/get cbook
Massi
/get
Massi
/get cbook
Massi
thank you so much king
Avique
in c++, If i initialize object variables outside the constructor, will it be equivalent to do these operations at runtime, "manually"? For example, for this class: class AClass() { public: AClass() { } private: int t[16] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 }; int n = 0; int p = 0; [...] // class funcions }
Avique
It will convert it to the default constructor with init list that does all of the above
good. for what i am doing now, just a few random things will be inside the constructor, so they are initialized at runtime when each object is created. thank you! (:
Vlad
The only difference is "when"
Vlad
Init list is executed before getting into the body of the constructor
Avique
Init list and constructor does all its things at runtime unless it is constexpr context
i have a few defines for this class, but i am not sure it would be a nice idea putting them as constants in the object. would not that occupy more space than how defines are used, which can be contained in many CPU instructions?
Vlad
class Foo { static constexpr int bar = 42; };
Avique
Ever learnt what static's do? :P
yes, i have, long ago - i forgot exactly what it is. so, i refreshed about it here: https://www.geeksforgeeks.org/static-keyword-cpp/ And static variables or properties would not be good here.
Avique
class Foo { static constexpr int bar = 42; };
mmm... constexpr together with it?? (( reading: )) https://stackoverflow.com/questions/13865842/does-static-constexpr-variable-inside-a-function-make-sense
Vlad
Are you just fond of storing constants in EACH object for no reason?
Avique
yes, i have, long ago - i forgot exactly what it is. so, i refreshed about it here: https://www.geeksforgeeks.org/static-keyword-cpp/ And static variables or properties would not be good here.
"And static variables or properties would not be good here" : because the objects have a few things that are based on fixed numbers, but their properties are not a copy of them. Based on them, but not a copy.
Avique
Are you just fond of storing constants in EACH object for no reason?
no, no! i am not storing constants for each object. there are "constants" that have a fixed value for one object, but this fixed value is not necessarily equal for all the other objects of that class.
Avique
Then make them const and initialize in the init list
mmm... const properties can be changed by an object instance at runtime?
Vlad
No. You assign it once on creation of an object
Anonymous
/get cppbookguide
Anonymous
Hello, I can get where to study program in c or a book?
Y
Hello! Can anyone help me building GitHub repo via qt. I'm completely new to cpp. (I don't know any code and I'm banging my head on Google and stack overflow just to find the solution...then one friend recommended to search in on telegram). Repo is opensource and I can share link privately if someone want to help me..🥺
SetPf
Hello. How i must make copy constructor for a struct with anonymous union?
Anonymous
Thank you
Pavel
Hello. How i must make copy constructor for a struct with anonymous union?
We're talking about C++ right? Is it exposed outside of your struct? If not, you should know currently stored in union type inside the struct?
SetPf
We're talking about C++ right? Is it exposed outside of your struct? If not, you should know currently stored in union type inside the struct?
Maybe i have wrong architecture, but it described in outside table. Struct carries index for this table. So than i must address to this table and get type. Just binary copy would be ok =\
SetPf
I use this structs only for data encapsulation, nothing more. struct Device::Value { const char* const as_string; union { uint8_t as_byte; union { int32_t as_int; uint32_t as_uint; uint8_t as_array[4]; }; union { uint16_t as_word; struct { uint8_t lsb; uint8_t msb; }as_bytes; }; }; ~Value(){ if(as_string) { delete as_string; } } };
SetPf
Yeah it hard shitty coded =)
Anonymous
Yeah it hard shitty coded =)
Even looking at it hurts! 😁
Anonymous
Hello, could anyone suggest me a good book recommendation? I am looking for something like "Control electronic C ++ devices Yanta Catupitia Kim Bentley" pleeese