BinaryByter
I'm not home and i refuse to code on phone
MᏫᎻᎯᎷᎷᎬᎠ
Brand new member
Tushar
#include<stdio.h> int main() { int a[5][5]={0},i,j,low=0,top=4,n=1; for(i=0;i<3;i++,low++,top--) { for(j=low;j<=top;j++,n++) a[i][j]=n; for(j=low+1;j<=top;j++,n++) a[j][top]=n; for(j=top-1;j>=low;j--,n++) a[top][j]=n; for(j=top-1;j>low;j--,n++) a[j][low]=n; } printf("\t\t\t\tPerfect Square\n"); for(i=0;i<5;i++) { printf("\n\n\t"); for(j=0;j<5;j++) { printf("%6d",a[i][j]); } } return 0; }
Tushar
Check it
uncle
Check it
thanks ver much.. i please can you try an odd dimension.... like (4,5) (3,6) (7,3).............
Tushar
Give me the series...
Sanket
Hey guys !! Can you give me some real life example of oop except the car and person example...
Sanket
Yeah bro other than this
Sanket
I need something different example as I am going for interview.
Tushar
An architect will have the blueprints for a house. Those blueprints will be plans that explain exactly what properties the house will have and how they are all laid out. However it is just the blueprint, you can't live in it. Builders will look at the blueprints and use those blueprints to make a physical house. They can use the same blueprint to make as many houses as they want....each house will have the same layout and properties. Each house can accommodate it's own families...so one house might have the Smiths live in it, one house might have the Jones live in it. The blueprint is the class...the house is the object. The people living in the house are data stored in the object's properties.
uncle
I didn't understand
like for 5x4 is something like this; 1 2 3 4 14 15 16 5 13 20 17 6 12 19 18 7 11 10 9 8
Tushar
Okay... wait..
Tushar
#include <stdio.h> const int MAX = 100; void spiralFill(int m, int n, int a[][MAX]) { int val = 1; int k = 0, l = 0; while (k < m && l < n) { for (int i = l; i < n; ++i) a[k][i] = val++; k++; for (int i = k; i < m; ++i) a[i][n-1] = val++; n--; if (k < m) { for (int i = n-1; i >= l; --i) a[m-1][i] = val++; m--; } if (l < n) { for (int i = m-1; i >= k; --i) a[i][l] = val++; l++; } } } int main() { int m = 10, n = 5; int a[MAX][MAX]; spiralFill(m, n, a); for (int i=0; i<m; i++) { for (int j=0; j<n; j++) printf("%d\t",a[i][j]); printf("\n"); } return 0; } m --> no. of rows n --> no. of columns
Tushar
Any more questions..
Dima
What do you need
Dima
no assignments
Anonymous
Hello, I am stuck with my C homework and I just want to understand what should I do. Homework about the converting C++ code into C code there are header files and source files. If any one is willing to help can you write me via gmail (ihurata123@gmail.com) or you can give your mail addresses. I really just want to understand which path should I follow. I can explain better if anyone send me mail. I will be greatful if you help. Thank you and have good day to everyone.
uncle
Any more questions..
no.. thanks verymcuh. i'm just trying to use functions.. but its not a problem
Mihail
what do you mean by "Homework about the converting C++ code into C"?
Mihail
converting C++ to C isn't possible
Anonymous
Anonymous
Its a 2D particular system and instructor gave us the cpp codes. I mean header files and source files
Anonymous
No mail, thank you :)
is it forbidden ? I am sorry
Mat
is it forbidden ? I am sorry
Let's say it's everywhere a bad habit :D
Anonymous
Yea
Anonymous
exactly
Anonymous
But, the problem is we just learn C and I have no idea about C++
Hairie
hello can anyone tell me how to start up to learn c/c++ programming..thanks 😊
Anonymous
😂funniest thing ever
Mihail
Yea
well that isn't possible
Mihail
are you sure you understood the homework correctly?
Anonymous
Check the red part
Anonymous
I am not sure if I understand correct
Dima
the red part must be retarded one
Mihail
oh yeah you could rewrite it in C yourself. At first I thought you had to write a program to do the conversion, but that'd be impossible.
MᏫᎻᎯᎷᎷᎬᎠ
Unpopular opinion: Any program include string processing or anything similar SUCKS
BinaryByter
what?
BinaryByter
you mean that #include <string> makes a program suck?
Anonymous
xdddd
BinaryByter
😂
Michael
can someone help me to write a simplest c++ program which can work integration
BinaryByter
I'm sorry, I am against integration
BinaryByter
The road of integration is uneven
BinaryByter
Sometimes you have random jumps to perform
BinaryByter
trust me, integration isn't possible in such circumstances
Michael
😔What shall i do then
BinaryByter
vote AFD
BinaryByter
string PROCESSING
So you are saying that we should stop processing strings?
MᏫᎻᎯᎷᎷᎬᎠ
I hate it
Mihail
You mean pre-processing?
BinaryByter
yea, that sucks
lets forbid compilers from processing strings
BinaryByter
also, lets stop checking passwords
BinaryByter
who needs them anyway, afterall there is no secure encrpytion 😂
MᏫᎻᎯᎷᎷᎬᎠ
also, lets stop checking passwords
Yeah + People seems nice these days xD
Anonymous
vote AFD
.warn on off topic
BinaryByter
Try out Durov's challenge then
what's his challenge?
Asad
If someone hacks and solves Telegram's end-to-end encryption, Durov will give him/her 300k
BinaryByter
Nice 🤔
BinaryByter
:D
MᏫᎻᎯᎷᎷᎬᎠ
Nice 🤔
I take 10% cut for the cheering Go go
BinaryByter
you don't get anything :D