Results 1 to 17 of 17
Thread: -
Hybrid View
-
12th August 2010 13:57 #1Registered User
Join Date: Jun:2010
Location:
Posts: 171
-
, , , , .
.
Code:#include <stdio.h> int main(void) { int height,rows,empty,k=0,i,a,m=1,s,h=2; printf("Enter odd number: "); scanf("%d",&height); for(rows=1;rows<=(height/2+1);rows++) { for(empty=1;empty<=(height/2+1)-rows;empty++) { printf(" "); } for( i=1;i<=rows+k;i++ ) { printf("*"); } k++; printf("\n"); } for(rows=1;rows<=height/2;rows++) { for(a=1;a<=m;a++) { printf(" "); } m++; for(s=1;s<=height-h;s++) { printf("*"); } h+=2; printf("\n"); } getch(); }
-
12th August 2010 21:35 #2Registered User
Join Date: Dec:2007
Location: Sofia
Posts: 366
- empty, i, a s
-
-
13th August 2010 12:47 #3Registered User
Join Date: Jun:2010
Location:
Posts: 171
, .
-
13th August 2010 14:09 #4Game programmer
Join Date: Feb:2007
Location:
Posts: 1,948
Last edited by Todor032; 13th August 2010 at 14:18.
-
13th August 2010 14:23 #5Registered User
Join Date: Jun:2010
Location:
Posts: 171
, , nested loop. .
-
13th August 2010 21:02 #6Registered User
Join Date: Dec:2007
Location: Sofia
Posts: 366
nested loops.
(, rows), . (, ' ' '*'), .
-
13th August 2010 13:18 #7Registered User
Join Date: Oct:2003
Location:
Posts: 4,317
, , , .
. , , , . , .
-
14th August 2010 00:00 #8
, ( ++, ):
- -
-
- . !
:Code:#include <string.h> #include <stdlib.h> #include <stdio.h> using namespace std; int main(int argc, char *argv[]) { char *line = NULL; int length = 0; int start, end; do { printf("Enter odd number:"); scanf("%d", &length); } while(length % 2 == 0); line = (char*)malloc((length + 1)*sizeof(char)); line[length] = 0; memset(line, (int)' ' & 0x00FF, length*sizeof(char)); start = end = length / 2; for(int i = 0; i < length; i++) { if(i < length/2 + 1) { line[start--] = line[end++] = '*'; } else { line[++start] = line[--end] = ' '; } printf("|%s|\n", line); } free(line); system("PAUSE"); return EXIT_SUCCESS; }
Code:void print_chars(char symbol, unsigned times) { /* , * symbol, times */ } int main(int argc, char *argv[]) { .... for(int i = 0; i < 10; i++) { ... print_chars('*', i); } .... }Last edited by mitkohr; 16th August 2010 at 10:01.
Gigabyte X570 Aorus Elite, AMD Ryzen 7 5800X@PBO+200, Noctua NH-D15, 2x16GB G.Skill F4-3600C17D-32GTZR, Palit GeForce RTX 4070 Ti GameRock Classic, 2x Sandisk Extreme II 240GB (not in RAID)+WD 320GB AAKS + WD40EZRZ + Toshiba X300 6GB, Cooler Master HAF 922, CORSAIR 750W CX
-
14th August 2010 11:34 #9Registered User
Join Date: Oct:2003
Location:
Posts: 4,317
-
15th August 2010 16:06 #10Registered User
Join Date: Jun:2010
Location:
Posts: 171
mitkohr
-
16th August 2010 00:27 #11
bsb (10 ) - (Java-
).
- ():
Code:line = (char*)malloc(length*sizeof(char) + 1); line[length] = 0;Gigabyte X570 Aorus Elite, AMD Ryzen 7 5800X@PBO+200, Noctua NH-D15, 2x16GB G.Skill F4-3600C17D-32GTZR, Palit GeForce RTX 4070 Ti GameRock Classic, 2x Sandisk Extreme II 240GB (not in RAID)+WD 320GB AAKS + WD40EZRZ + Toshiba X300 6GB, Cooler Master HAF 922, CORSAIR 750W CX
-
16th August 2010 00:45 #12Code:
line = (char *)malloc((length + 1) * sizeof(char)); line[length] = '\0';
EVGA X299 FTW K|i9-7960X@4.7|4x8 Patriot Viper Steel 4000|GTX 1660 Ti|970 EVO 1 TB|Seasonic Focus GX-1000|Xigmatek Elysium|
Rampage IV Extreme BE|E5-1680v2@4.7|4x4 HyperX 1866|Cougar Aqua 240|GTX 1050 Ti|970 EVO 1/4 TB|CM 850 SilentPro|HAF-X|
-
16th August 2010 06:45 #13Mire-x
Join Date: Apr:2005
Location: Sofia
Posts: 763
-
16th August 2010 07:56 #14
-
16th August 2010 11:24 #15
-
16th August 2010 22:37 #16Registered User
Join Date: Dec:2007
Location:
Posts: 655
-
16th August 2010 09:58 #17Gigabyte X570 Aorus Elite, AMD Ryzen 7 5800X@PBO+200, Noctua NH-D15, 2x16GB G.Skill F4-3600C17D-32GTZR, Palit GeForce RTX 4070 Ti GameRock Classic, 2x Sandisk Extreme II 240GB (not in RAID)+WD 320GB AAKS + WD40EZRZ + Toshiba X300 6GB, Cooler Master HAF 922, CORSAIR 750W CX




Reply With Quote
), -.
Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in