Manav
I think this one is better https://pastebin.com/W3YGBSwf
Also for the sake of readability, have good variable names. Add comments, etc. It will help other developers and even you when you look at your code after some time.
数学の恋人
I think this one is better https://pastebin.com/W3YGBSwf
start by spliting the problems in smaller functions then have good variable names don't forget about comments, use them to explain what a function is doing
Manav
is it better now? https://pastebin.com/7WRqvhwA
Have you not been taught how to structure code?
PaAaAria
Have you not been taught how to structure code?
unfortunately, no, I haven't
Manav
unfortunately, no, I haven't
Here: https://gist.github.com/derofim/df604f2bf65a506223464e3ffd96a78a
Manav
thx
There are many styles you can go for but essentially when you encounter a block you indent the sentences, like this: fun () { // at this indent inside fun Statement1; Statement2; for () { //inside for loop Statement3; if () { Statement4; } } return Expression; }
Manav
thx
I would throw away the book/resources you are learning C++ from if I were you. If it doesn't teach the importance of code readability
Manav
actually I want to only get rid out of it😂, I don't like programming that much
Lol, I think the resource you are learning from is the reason you don't like programming
Manav
Here, a curriculum of free good quality courses which teach you CS: https://github.com/ossu/computer-science
PaAaAria
Lol, I think the resource you are learning from is the reason you don't like programming
Maybe I didn't have any idea of programming until university and you can guess What happened 😁
Don Peter Joseph
which is the best java group
Don Peter Joseph
can somebody help me fix my java code
Don Peter Joseph
https://pastebin.com/EShqp73u
Ozan
Hi i have a question. What is the first executed program in C? A-main function B-include statements C-switch block D-comment line E-function is a order From top to bottom
Anonymous
A that's like homework.
Vitalii
Hi, I have a little stupid question: What to do when I have int numbers, for instance: int a=22, b=20 And I need to find a/b and give this value to "res". res has a data type "double" Why it turns me 1.0000 but not 1.1000😶
Ozan
A that's like homework.
İ took the exam yesterday .i want to learn true answer
Alex
Any other way?
if you have literal you can use 5.0/2.0 instead of 5/2
Igor🇺🇦
Any other way?
What's wrong with the one suggested?
Vitalii
What's wrong with the one suggested?
Because I can't change a data type because of my given condition
Vitalii
Oh, sorry, I found out
Igor🇺🇦
Because I can't change a data type because of my given condition
You are not changing you variables types. It's casted for these operation only
RC
Can anyone help me how to start to code c in vs code?
V01D
Get a life Coronavirus
ברני
https://onlinegdb.com/Bd4-iTSRM
Hey.. I'm still stuck on the same task from yesterday, I can't figure out what is wrong... Trying to print 3 2d char arrays.. On C
ברני
Can anyone help me how to start to code c in vs code?
You mean where to download Visual Stodio?
RC
You mean where to download Visual Stodio?
I downloaded it but I don't know which c program should I download and to write code
ברני
And what's the problem?
It doesn't print my arrays right..
ברני
I Made it table
Anonymous
It doesn't print my arrays right..
What do you mean "right"?
ברני
What do you mean "right"?
I wanted it to print every array that the output will be: ,a, b, c d, e, f
Anonymous
I wanted it to print every array that the output will be: ,a, b, c d, e, f
Then why you do not print a new line after each row?
ברני
Somthing is wrong with what I'm doing, on int 2d array it works perfect... First time I'm trying char array and on visual in gives me also weird marks and not the right chars
Anonymous
I did
Tell me please which line prints a new line after each row?
ברני
I downloaded it but I don't know which c program should I download and to write code
VS has it already, you creating a new project gives it a name and on the right you have few files, the last one called source, right click on it do "new" its the first, change down the name from Source.cpp To *the name you want".c And thats it you can start
Anonymous
Anonymous
36
Wrong, try to think why
Omkar77
No
Then ?
Anonymous
Then ?
onlinegdb
ברני
Omkar77
Anonymous
Heii evryone
Anonymous
OK I will, ty
Tell me your assumption
Anonymous
It's simple
Anonymous
It prints a new line character after each matrix is printed
Anonymous
Not each row
Anonymous
@Barneysworld, do you understand?
Anonymous
You printed the whole matrix in one line and then printed a new line
Anonymous
Which is clear from your code
ברני
Anonymous
Anonymous
It is not inside
ברני
Are you joking on me?
Whaat🤦‍♂🤦‍♂🤦‍♂🤦‍♂🤦‍♂🤦‍♂🤦‍♂🤦‍♂🤦‍♂🤦‍♂
ברני
Sorry
ברני
It still don't print it right.. And on VS it dose it even worse
ברני
It's adding marks instead of the letters on VS and online it make it on the side
Mohammad Javad
hi everyone how i can write this code more easily ? int main() { int size=-1; while(size<1 || size>100) scanf("%d", &size); int squares[size]; for (int i = 0; i < size; i++) { squares[i] = (i + 1) * (i + 1); } int x[size * size]; int result = 0; for (int i = 0; i < size * size; i++) { x[i] = -1 * (i + 1); for (int j = 0; j < size; j++) { if (squares[j] == (-1) * x[i]) x[i] = -x[i]; } result += x[i]; } printf("%d", result); return 0; }
ברני
It is not inside
I figured it out.. On the calling function I made Cols before Rows🤦‍♂
ברני
Wrong order, misrable life 😔
Xudoyberdi
Wrong order, misrable life 😔
Don't kill yourself, be strong
Anonymous
how to run proteus professional help me
Mohammad Javad
how i can change this algorithm to another ? int main() { int size=-1; scanf("%d", &size); int squares[size]; for (int i = 0; i < size; i++) { squares[i] = (i + 1) * (i + 1); } int x[size * size]; int result = 0; for (int i = 0; i < size * size; i++) { x[i] = -1 * (i + 1); for (int j = 0; j < size; j++) { if (squares[j] == (-1) * x[i]) x[i] = -x[i]; } result += x[i]; } printf("%d", result); }
Mohammad Javad
What is the task?
S=1−2−3+4−...−(n−1)+n power 2 i dont now how to write this algorithm in c