0 like 0 dislike
832 views
Show more...
[Exercise] Essay (Open question) - asked in 作業 by (18k points)
ID: 19794 - Available when: Unlimited - Due to: Unlimited

edited by | 832 views

7 Answers

0 like 0 dislike
Hidden content!
#ifndef color_RGB



#define color_RGB



#include * * ** **



struct Color {



 


***** * *** * * ** r;


** **


* * *** *** *** g;


***


* * * *** ******** ** b;


**



};


*



void ** * * Color *c, int r, int g, int b)



{


* * ** * ** *** * *


* **** **** *** ** ** * = r;


****


** * * * ** *** * *** * * = g;


* * * * *** * * * *


* *** *** * * * *** ** * = b;


* ** * * * ***



}


*** **



struct Color ********* * * Color c[], int n)



{


** * * ** * * *


** **** *** * * ** ** * Color avg;


** *** * ***** ** **** **


* ** ** * * * * ** ******


* * *** *** ** *


** **** ** ** **** (i = 0;i < n;i++){


** *** * ** * ** * **** ** * * * * * **


** * * *** * ** * *** ** ** * * * * * *** += c[i].r;


** * * ********** ***** *** * *** * *


******** *** ******* **** ** * *** * * += c[i].g;


** ** * * **** * ** **** ** ** *** *


*** * *** ***** ** * ** * * ** * *** * * * += c[i].b;


* *** * ** *** *** * * * * * * * * ** *** **


*** * * ** * ** * *


**** ** ** * *** **


**** * * * ** * ** ** ** = sr/n;


* * * ** ** * * ** * *


* *** * *** ** *** **** * * = sg/n;


* * ** *** ***** **** * *


* *** *** * ******* * * * = sb/n;


* * * ** * ******** *


** * ** avg;


*



};


* *



double * ** * * Color c)



{


* **


*** ** ** * * ** * **** bright;


**** * * * **** *** * *


* ***** ** **** * ** * * * = (c.r + c.g + c.b) / 3;


* *** * ****** *


*** * * ** ** ** ** ** bright;


* ** * * * *** *** * ** *



}


** *



void * ** * * ** Color *c)



{


** ** ** * * * ***** * * *


** ** * *** * ** * ** * ** * * * ** ** * * *** * * **** ** ** ** * *** *** ***


* * * * * **** * * *



}


** *



#endif
answered by (122 points)
0 like 0 dislike
Hidden content!
#include * ****** *



struct Color{
* * ** * * ***** * * * * * ** *** * *** * r;
* **** ** **** ** * * ** * ** * *** g;
* ** ** * ***** ** **** ***** ** ** * b;

};



void initColor(struct Color *c, int r, int g, int b){
* ***** ****** **** * * ** * * *** = r;
* * **** * ** ** ** **** * * ** * = g;
*** *** * * **** *** ** * ****** = b;

}



double brightness(struct Color c){
** **** ** *** ** ***** ** ** * * * * (c.g+c.b+c.r)/3.;

}



void printfColor(struct Color *c){
** * * * ** ** ** * ** * * * * ** ***** * ****** *** * ** *

}



struct Color averageColor(struct Color c[], int n){
***** * * *** **** * ** ** *** * * * * Color c_a = {0,0,0};
*** ** * * * * * * * **** ******** * **** ** * * ** *
**** * * ** * * *** * * * **** * * ** * *
***** * ***** ** *** ** *** * * ** ** *** ** **** *** * ** += c[i].r;
**** * * * ** ** ** ** * * * ** * * * * * ****** += c[i].g;
** ** * * * *** * ** * **** ** * ** ** ** * * * *** ** * * += c[i].b;
*** *** * * *** ** ** *** * ** **
* * * * ** * * ** ** **** ** ** c_a ;

}
answered by (-162 points)
0 like 0 dislike
Hidden content!
void ** * * * ** r,int g,int b)

{ c -> r = r;
** * *** ** **** -> g = g;

c -> b = b;

}

struct Color *** * * * * * Color c[],int n)

{
* * ****** ** ******* *** * ** ** ** Color ******* Color c[],int c)

{  
*** ** ** * * ** * * ** **** Color avg;
*** ***** * ** ** ** * ***** * * ** ** **** * * ** *
* ** * *** * * * ** *** * *** **** ** * * ** *
** * *** * *** ** ** * **** ** **
* ** * * ** * * * ** * *** ** * * * += c[i].r;
** ** * ** *** * * * * ****** ** ** ** ** * * ** += c[i].g;
** * * **** * * * *** *** ** ***** * * * += c[i].b;
*** * * * ** * * ** * *** * *
* * * * * * * * * * *** * * * ** ** * = tr/n;
**** * **** * **** ** ** ******* * * * * tg/n;
* ** ** * * * * *** * ******** * * ** tb/n;
* * ** * ** ** ****** * *** ***** *** ** * avg;

}

double ** * ** * Color c)

{
* ******* * * * ****** *** *** ** **** * ** * bright * * ***
** ** ***** * * ** **** * ** ** * * * bright;

}

void **** * * * Color*c)

{ *** * * * * *** * * ** * -> r,c -> g,c -> *** ** * *

}
answered by (-186 points)
0 like 0 dislike
Hidden content!
not finish



#include <stdio.h>



struct Color {
** *** * * * * ** * r;
* ** * * * * * g;

   int b;

};



void initColor(struct Color *c, int r, int g, int b){
** * ** ** * *** * * * ** = r;
** *** * * * *** ** * **** *** * ** = g;
* * * * * * *** ** ** **** * * = b;
*** **** ** * ** **** * **
* ** * * * * ** ** * *** *



struct Color averageColor(struct Color c[], int n){
** * * ****** * * *** ***** * * * * j=0;
** **** ***** * ****** *** ** * *
* ** ** * ** ** * ** * ** ** Color avg = {0,0,0};
*** * *** ** *** * ***** **** ***
** * * * * ** *** * ** * ** *** (j=0; j<n; j++){
* ** * * **** * * * ** * ** * *** ***** *** * ** * * ** * ** = avg.r + j.r;
* * * **** ** * * ** * * ** * *** * *** ** ** * ** *** = avg.g + j.g;
* **** *** * ***** ** * * ** ** ** * * * * ***** * *** * * = avg.b + j.b;
* **** ** **** * **** * * *** * ***** * *** * * * * * * ***
*** * * * * *** * * * *** ** *****
* ***** ** * * * ** ** ****** ***** ****** = avg.r / n;
** * ** * * * * *** * * *** ** * * * = avg.g / n;
** * *** *** * *** * ** ** * * ****** * ** ** = avg.b / n;
* ** * ***** * ** * ** ****** ** * * * *
******** * * ***** ** * * * ** * ****** * avg;
* ********* * ** **** * * ***** *** **
* ** * * **** ** **** *** * * * ** ** * * * * * * *** ***



double brightness(struct Color c){
** * **** **** * * ** ** ** ** * ** ( c.r + c.g + c.b ) / 3;
* *** ** * * * ****** * * * **** *



void printColor(struct Color *c){
** * * * ** * * ** **** * *** ** *
*** *** ****** * ** * * * *** *
* * * *** * ** * *** * *
answered by (-170 points)
0 like 0 dislike
Hidden content!
#include **** **** ****

#include * ** **** **** **
* * ** ***** *



 



int main(void) {


* * * * ***** ** * *** ** ** * Color *c;
* *** * * ** * *** * *** **** Color));

}

void initColor(struct Color *c, int r, int g, int b)

{
** ******** * ** * * * * * * ** *
* * *** * ******* *** * ******
* * *** * ** * ** * * * ***

};

struct Color averageColor(struct Color c[],int n)

{
*** ** ******** * *** Color a;
* * * ** ** * ** i=0;
** **** * * ** * * ** ***** *** * ***
* ****** *** * * *
** * * * * ******* *** ** * * * * * ** * *** ** **
* ** ** ** ********** ****** ** ** ****** * *** *** ** ** * *
*** *** ** ** * * * *** ** * **** ******** *
* * * *** ** ** **
*** * ****** ** * ** *** *
* *** **** *** ** * **
* ** * *** ** **** ** *
* * * ** ** *** ** * *** *** a;

}

double brightness(struct Color c)

{
* * * * * * * *** *** * L;
** * * **** *** ** * * * * * * ***
* *** ** * * * * ****** L;

}

void printColor(struct Color *c)

{
*** * * ** ** ** **** ** * ** * is * ** ****** *

}
answered by (-38 points)
0 like 0 dislike
Hidden content!
void initColor(struct Color *c, int r, int g, int b)
** ** * **** *** **** ** * ***
* * * * * ** * * * **** -> r = r;
* * ** * * * * **** * * -> g = g;
* *** * * * ** ** ** * **** *** -> b = b;  

}



struct Color averageColor(struct Color c[], int n)
* * * ** *** **
* * ** * ** **** * ** *** * * **** * **** * i,sr = 0,sg = 0,sb = 0;
* *** ** * * * * *** * * *** ***** *
** ** * * ******* * ***** ** *** ** * ****** = 0;i < n;i++)
* * ** ***** * * * ** * * * ** ***
* * *** * * ****** * * * * *** * ** ** *** += c[i].r;
* ****** ** * ** * * * ** * * += c[i].g;
** *** **** * * * * *** * * *** * += c[i].b;
** * *** ** * ***** **** ******* ** *
*** ** * * ** * * * * ** ** * * * ** *
** ** ** **** ** *** ** * **** * * ** * * * * = sr / n;
* ** ** * * * ** * ** * *** * = sb / n;
*** * * * ** * ** *** * * ** * * * = sg / n;
* * *** ** * *** ** * * * * * * ** ** **
* ** * **** ** ** ** ** * * * ** * *** ** ** avg;
***** * * *** **** ** * * *** * ***



double brightness(struct Color c)
* * * * * *

***** * *** ****** **** ** *** * ** *** * ** bri = (c.r + c.g + c.b) / 3;
* *** * ** * * * **** ***** ** ******* *** bri;
**** *** ** *** * * ** ** * ***

void printColor(struct Color *c)
*** *** *** * * * * ** ******* *
* ** ***** *** * * *** * * ** ** ** ** * * ** * * * %g",c -> r,c -> g,c -> b,brightness);
** * * * * * * * *** * *** **** * * * *** * ****
answered by (-264 points)
0 like 0 dislike
Hidden content!
void initColor(struct Color *c, int r, int g, int b){
** *** ** ** * * ** *** ** = r;
* * *** ** **** * *** ** ** * * * * = g;
* * ** ** * * * * **** ***** = b;

}



struct Color averageColor(struct Color c[], int n){
* * ** *** * ** * * ** * ****** * * * * * *** Color avg;
* * * ** ***** ** ***** ** * * *** * * ** i,tr=0,tg=0,tb=0;
* * * *** ** *** * * * ** * * *** * ** ** *
* ** ** * * ** ** ** * ** ***** * **** *** += c[i].r;
* ** * ** *** * * *** ** ** * * ** ** += c[i].g;
**** ** ** *** ** ** ******** ** ** ***** ** ** ** **** * * += c[i].b;
** * * * ** **** * *** * ** ***
** ** ** * * * * * ** *** * ** *** * = tr/n;
* ** * * ** ** *** * * *** * = tg/n;
** * ** * * * ** * ** * *** * *** * = tb/n;
***** ** * * * * * * * * ** *
** * * **** ** * *** **** * * ** ** ** ** ** avg;

}



double brightness(struct Color c){
** **** *** *** ** ** * * *** * * * * bright = (c.r+c.g+c.b)/3;
***** * *** * ** * ** **** * *** *** * bright;

}



void printColor(struct Color *c){
** ** * ** *** ** * * * * *** ***** * ** * * ** * *** ** * * ** * * **

}
answered by (-216 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.59.111
©2016-2025

Related questions

0 like 0 dislike
23 answers
[Exercise] Essay (Open question) - asked Dec 22, 2016 in 作業 by Shun-Po (18k points)
ID: 19793 - Available when: Unlimited - Due to: Unlimited
| 1.7k views
0 like 0 dislike
65 answers
[Exercise] Coding (C) - asked Nov 24, 2016 in 作業 by Shun-Po (18k points)
ID: 17667 - Available when: Unlimited - Due to: Unlimited
| 3.8k views
0 like 0 dislike
20 answers
[Exercise] Essay (Open question) - asked Nov 10, 2016 in 作業 by Shun-Po (18k points)
ID: 17220 - Available when: Unlimited - Due to: Unlimited
| 1.6k views
0 like 0 dislike
31 answers
[Exercise] Essay (Open question) - asked Nov 3, 2016 in 作業 by Shun-Po (18k points)
ID: 16958 - Available when: Unlimited - Due to: Unlimited
| 2.4k views
0 like 0 dislike
31 answers
[Exercise] Coding (C) - asked Oct 20, 2016 in 作業 by Shun-Po (18k points)
ID: 14582 - Available when: Unlimited - Due to: Unlimited
| 2.3k views
12,783 questions
183,442 answers
172,219 comments
4,824 users