|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: |
#include<stdio.h>
#define BLANK ' '
void writePattern(char c1, char c2, char c3, char c4, char c5, int n1, int n2, int n3, int n4, int n5, int length);
void writeCharFixCount(char, int *, int *);
int main( void) {
char mark = '*';
char dot = '.';
int i;
int width, length;
int size;
int x = size;
//length == size;
//width == size;
printf("Please enter an integer in the range 1-8 both inclusive: ");
scanf("%d", &size);
for( i = 1; i <= size; i++){
writePattern('*','.',BLANK,BLANK,BLANK,1, size-1,0,0,0, size);
if (i = size-x)
writePattern( '*','.',BLANK, BLANK, BLANK, size-x,size-(size-x),0,0,0, size);
if (i = size-1)
writePattern( '*','.',BLANK, BLANK, BLANK, size-1,size-(size-1),0,0,0, size);
if (i= size)
writePattern('*','.',BLANK,BLANK,BLANK,size, size- size ,0,0,0, size);
}
return 0;
}
void writePattern(char c1, char c2, char c3, char c4, char c5,
int n1, int n2, int n3, int n4, int n5, int length) {
while ((n1 > 0) && (length > 0))
writeCharFixCount(c1, &n1, &length);
while ((n2 > 0) && (length > 0))
writeCharFixCount(c2, &n2, &length);
while ((n3 > 0) && (length > 0))
writeCharFixCount(c3, &n3, &length);
while ((n4 > 0) && (length > 0))
writeCharFixCount(c4, &n4, &length);
while ((n5 > 0) && (length > 0))
writeCharFixCount(c5, &n5, &length);
printf("\n"); /* advance the cursor to the beginning of a new line */
}
void writeCharFixCount(char c, int *count1, int *count2)
/* writes one copy of character c and decrements count1 and count2 */ {
printf("%c", c);
(*count1)--;
(*count2)--;
}
|
Advertisement
| Hall of Fame |