Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Lab 9 v1
//gcc 5.4.0 #include <stdio.h> #include <string.h> int main(void){ int n=4; int m=4; int ca=0; int cb=0; int ci=0; int c=0; char A[4]={'a','b','c','d',}; char B[4]={'c','d','e','f',}; //char U[30]; char I[30]; //n=sizeof(A)/4; //m=sizeof(B)/4; char U[n+m]; //printf("%d=n+m\n",n+m); printf("Intersection\n"); for(int i=0;i<=n;i++){ for(int j=0;j<=n;j++){ if(A[i]==B[j]){ I[ci]=A[i]; printf("%c\n",I[ci]); ci++; } } } printf("\n\n"); printf("Union\n"); for(int g=0;g<n+m;g++){ if(g<n){ U[c]=A[ca]; printf("%c\n",U[c]); ca++; c++; } else{ for(int d=0;d<m;d++){ if(B[d]==I[d]){ cb++; } else{ U[c]=B[cb]; printf("%c\n",U[c]); cb++; c++; // printf("=cb%d\n",cb); } } } } printf("\n\n"); }
run
|
edit
|
history
|
help
0
Lab 8 part 2 v.06
MATRICES DE CARACTERES
Card shuffling and dealing program using structures
otro avance de pregunta 2
Atomic Openmp
muuchas funciones utiles
If Statements/Increments V1
coding!!Woo!!
ECE 2574 1/23
dcl