Diego😁
Hi
Diego😁
How are you? Is anybody here?
Anonymous
How are you? Is anybody here?
No one is here, go away
Diego😁
so nice, thanks
Giorgi
/warn
Kkk
Hi guys
Kkk
I have an issue with an implementation of “Mastermind game” in C
Kkk
How can I do the comparison between the arrays? Because red pin is for same color and same position but white pin is for same color but wrong position. I attached my code
Kkk
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <time.h> #include <unistd.h> #include <dos.h> #include <windows.h> #define NUM_T 4 //definisco la "dimensione" del mastermind #define MAX_TENTATIVI_FACILE 10 //Numero di tentativi massimi livello semplice #define MAX_TENTATIVI_DIFFICILE 5 //Numero massimo di tentativi difficile #define NUM_COLORS 6 //Numeri colori del gioco typedef enum{ r,w,b,g,y,p } colore; //Definisco la struttura colore colore comba[NUM_T]; colore risposta [NUM_T]; void versionesemplice(); void versionedifficile(); void stampa(); void main(){ char difficolta; printf ("\nBenvenuto su Mastermind(R).\n"); printf ("Impostando come diffciolta difficile avrai al massimo 5 tentativi.\n"); printf ("Impostando come diffciolta facile avrai al massimo 5 tentativi. .\n"); riprova: printf("\nScegli il livello di difficolta: Premi 'S' o 'D' "); scanf ("%c", &difficolta); switch(difficolta){ case 'S': versionesemplice(); break; case 's': versionesemplice(); break; case 'd': versionedifficile(); break; case 'D': versionedifficile(); break; default: printf("\nCarattere non ammesso"); goto riprova; }} void versionesemplice() { srand(time(NULL)); int i=0; int pin=0; for (i=0; i<=NUM_T; i++){ comba[i]=rand()%NUM_COLORS; } reinserimento: for (int cont=0; cont<MAX_TENTATIVI_FACILE; cont++){ for(int c=0; c<NUM_T; c++) { printf("\nInserisci la tua combinazione numero %d: ", c + 1); scanf("%d", &risposta[c]); if (risposta[c] != r && risposta[c] != w && risposta[c] != b && risposta[c] != g && risposta[c] != p && risposta[c] != y) { printf("Errore carattere non ammesso"); goto reinserimento; } fflush(stdin); } stampa(); } } void stampa(){ int c=0; printf("Hai inserito questa combinazione\n"); for (c=0; c<NUM_T;c++) { if (risposta[c] == r) printf("RED\t"); if (risposta[c] == w) printf("WHITE\t"); if (risposta[c] == b) printf("BLUE\t"); if (risposta[c] == g) printf("GREEN\t"); if (risposta[c] == y) printf("YELLOW\t"); if (risposta[c] == 6) printf("PURPLE\t"); } } void versionedifficile(){ }
Anonymous
Lab Project : Write a project in c++ using loops and arrays to automate the exam system of your intermediate college. Instruction : write project in groups Deadline : 24 April, 2021 (corrected ) Main menu with functionality: Enter 1 for store student record Enter 2 for search student record Enter 3 for display all records Enter 4 for display particular subject record by Grade Enter 0 for exit Student_info : {name,father name, address,roll number} Subjects : {roll number, Math, English, Urdu} Mathematical calculations : Calculate average, Percentage, Grades, Pass, Fail
Anonymous
Any one can help me?
oldherl
Any one can help me?
* Asking to solve an assignment/test/whatever without trying it first yourself will get you a warn or will get you BANNED. We won’t write a code for you, but we can push you forward and suggest something.
Anonymous
I need help and guide me how i can write it.
Anonymous
I dont think so that learning is illegal anywhere
Binesh
Anonymous
Okay
Binesh
Menu functionality can be done by switch statement
[Gaal wase bilaa cashuur ]?_ 2 grals
Okay
Anonymous
Kindly give me some structure of that kind of program
[Gaal wase bilaa cashuur ]?_ 2 grals
Okay
Terlan
Hello
Terlan
How can I write a program subtracts 0 and 5 digits from a given number?
Terlan
Example Input: 75304 Output:734
Terlan
Can you help?
Diego
The easiest I can think of is turning it into a string, copying over all the characters that are not those, and parsing it back into an int
Anonymous
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <time.h> #include <unistd.h> #include <dos.h> #include <windows.h> #define NUM_T 4 //definisco la "dimensione" del mastermind #define MAX_TENTATIVI_FACILE 10 //Numero di tentativi massimi livello semplice #define MAX_TENTATIVI_DIFFICILE 5 //Numero massimo di tentativi difficile #define NUM_COLORS 6 //Numeri colori del gioco typedef enum{ r,w,b,g,y,p } colore; //Definisco la struttura colore colore comba[NUM_T]; colore risposta [NUM_T]; void versionesemplice(); void versionedifficile(); void stampa(); void main(){ char difficolta; printf ("\nBenvenuto su Mastermind(R).\n"); printf ("Impostando come diffciolta difficile avrai al massimo 5 tentativi.\n"); printf ("Impostando come diffciolta facile avrai al massimo 5 tentativi. .\n"); riprova: printf("\nScegli il livello di difficolta: Premi 'S' o 'D' "); scanf ("%c", &difficolta); switch(difficolta){ case 'S': versionesemplice(); break; case 's': versionesemplice(); break; case 'd': versionedifficile(); break; case 'D': versionedifficile(); break; default: printf("\nCarattere non ammesso"); goto riprova; }} void versionesemplice() { srand(time(NULL)); int i=0; int pin=0; for (i=0; i<=NUM_T; i++){ comba[i]=rand()%NUM_COLORS; } reinserimento: for (int cont=0; cont<MAX_TENTATIVI_FACILE; cont++){ for(int c=0; c<NUM_T; c++) { printf("\nInserisci la tua combinazione numero %d: ", c + 1); scanf("%d", &risposta[c]); if (risposta[c] != r && risposta[c] != w && risposta[c] != b && risposta[c] != g && risposta[c] != p && risposta[c] != y) { printf("Errore carattere non ammesso"); goto reinserimento; } fflush(stdin); } stampa(); } } void stampa(){ int c=0; printf("Hai inserito questa combinazione\n"); for (c=0; c<NUM_T;c++) { if (risposta[c] == r) printf("RED\t"); if (risposta[c] == w) printf("WHITE\t"); if (risposta[c] == b) printf("BLUE\t"); if (risposta[c] == g) printf("GREEN\t"); if (risposta[c] == y) printf("YELLOW\t"); if (risposta[c] == 6) printf("PURPLE\t"); } } void versionedifficile(){ }
/warn learn how to share code
Anonymous
Plzz help me the code fo minimum number of gas stations problem
Anonymous
I am facing some problem in below problem. My code is attached with it. It is not showing 2nd division. Q)Write a program which take marks of 5 subjects each so that maximum marks of each subject is 100. Display result pass or fail. Also write division obtained if candidate has passed. My code #include <stdio.h> #include <stdlib.h> int main() { float a,b,c,d,e,f,g; printf("Enter marks of each subject\n"); scanf("%f%f%f%f%f",&a,&b,&c,&d,&e); f=a+b+c+d+e; g=500.0; if(f>=30/100.0*g) printf("pass\n"); else printf("fail\n"); if(f>=60.0/100*g) printf("1st division"); if(f<35.0/100*g) printf("3rd divison"); if(f>35.0/100*g&&f<60/100*g) printf("2nd division"); }
[Gaal wase bilaa cashuur ]?_ 2 grals
Done
Anonymous
Done
What done
Subrat
How do I write a code for iterations where error<0.00001 and error= t1[i][j]-t0[i][j].
Subrat
if anyone knows numerical methods.
Subrat
There are two matrices t0 and t1, t1[i][j]=(t0[i+1][j] + t0[i-1][j] + pow(beta, 2)*(t0[i][j+1] + t0[i][j-1]) )/(2*(1+ pow(beta, 2))); this will be iterated untill t1[i][j]-t0[i][j]<0.00001 how to write iteration code and given t0[i][0]=0; t0[i][m-1]=1; t0[0][j]=0; t0[n-1][j]=0; using the above
Anonymous
Hello their! Can I ask a example for a 2d array that will ask user to input number or rows and columns. Then the user will input values needed for every rows and columns and after the user input values it will Display and arrange the numbers on how they should appear in rows and columns. after they appear it will get the sum for every rows and sum for every columns. I code something but idk how to do the sum part😓
[Gaal wase bilaa cashuur ]?_ 2 grals
Okay
Binesh
/warn
Hamid
You can easily walk through every row/column
Hamid
How can I write a program subtracts 0 and 5 digits from a given number?
You can get numbers one by one by doing this: while (num ¡= 0){ currentdigit = num%10; num /=10; }
Hamid
! or ¡ ?
I couldn't find ! That moment
Anonymous
I couldn't find ! That moment
I have never seen ¡ in my keyboard.
Hamid
Ah I'm using for loop for my cod
What's the problem then?
Hamid
Ah I'm using for loop for my cod
walk through columns: for x in 0..<coloums_len: for y in 0..<rows_len: arr[y][x]
Anonymous
#include<iostream> using namespace std; int R,C,x,y,a,b,n,num[10][10]; int main() { cout<<"How many rows? "; cin>>R; cout<<"How many collums? "; cin>>C; for(x=0; x<R; x++) { cout<<endl; for(y=0; y<C; y++) { cin>>num[x][y]; } } cout<<endl; for(a=0; a<R; a++) { for(b=0; b<C; b++) { cout<<" "<<num[a][b]; } cout<<endl; } return 0; } I don't really know how I can print out the total of the sum of each row and column and I don't know what to put to my code so can you suggest any?
Hamid
walk through columns: for x in 0..<coloums_len: for y in 0..<rows_len: arr[y][x]
you can define a sum variable, and put it above of second for also you can walk through every row by swapping first for loop with second for loop
Giorgi
Which C++ libraries are there for working with Telegram APIs?
Giorgi
telegram bot API?
Yes, for example!
Cesco
example
Giorgi
https://github.com/reo7sp/tgbot-cpp
I want to learn about it and I want to commit to one library which supports as much stuff as it can. Is that the only one? That library has not implemented some stuff
Anonymous
for (int i=0; i<n;i++){ s=s+m[i][0];} s will be the sum
Hmm seriously? Did you try it to my code?
Cesco
Hmm seriously? Did you try it to my code?
no but i did this thing a month ago with my school lemme show you
Anonymous
Which C++ libraries are there for working with Telegram APIs?
https://github.com/tdlib/telegram-bot-api
Cesco
https://del.dog/alimywesin.txt
Cesco
https://del.dog/alimywesin.txt
@Deingram23rd check this
Anonymous
https://del.dog/alimywesin.txt
Hey thanks for the code
klimi
Achiever why pm other people? :(
Neel
Can I post github link ?
Anonymous
Message from @neel_basu: Hello guys. I am working on dhyara, a MANET on ESP32 devices. Currently it provides an infrastructure-less AdHoc multi-hop multi-path network. The nodes in the network are identified by mac address instead of ip address. I'd welcome any contribution on https://github.com/neel/dhyara
Neel
is this different from esp-mesh? https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/mesh.html
Yes. It is infrastructure less. So there is no connection between ap and station. ESP Mesh is actually a single sink topology. So all the branches lead to the same sink. On the other hand dhyara is true graph. There is no connection. Any node can be sink or source at any time simultaneously.
Neel
Yes
Thanks.