Anonymous
No you don't
Ludovic 'Archivist'
Should I warn him?
Probably, you are the admin, not me (I rejected that responsibility long ago)
Ludovic 'Archivist'
He at least needed a bit of public shaming
Konstantin
......
Merry
hey, i have a bit long code (but specific problem) and prefer not to put it in one of the sites suggested in the rules, if someone can help me on private chat or something i would love that 😊
btw - the program is in c code :)
ברני
ברני
DGB is a good site
ברני
For sharing
Xudoyberdi
Anonymous
How we can print shapes using loops in c++?
Anyone can explain Concept/logic?
Roshan
Anonymous
Anonymous
I am confused to understand the logic/concept.
Roshan
Yes.
In case of a normal asterisk pattern like half pyramid. The first loop ends line and the inside loop prints it.
The loop inside will print 1 * if it's row 1, 2 * if it's row 2 and so on...
HaiNahi
You can i=size
For i to 1 decrease by one
i=j
For j to 1 decrease by one
Print star one time
Print new line
Anonymous
#include <iostream>
using namespace std;
int main()
{
for (int row = 0; row < 5; row++)
{
for (int star = 0; star < 20; star++)
{
cout << '*';
}
cout << endl;
}
system("pause");
}
Anonymous
Can you tell me how can I change this one into which print half pyramid?
HaiNahi
No take the copy of variable from upper loop and then iterate it in the inside one
Roshan
Make star var go upto row.
I.e, star < row (in your case)
HaiNahi
https://www.programiz.com/c-programming/examples/pyramid-pattern cheat from net and do ur hw ;)
Anonymous
Roshan
Anonymous
Roshan
HaiNahi
You should simply understand by intution
Anonymous
HaiNahi
Anonymous
I never asked the code, I asked the concept and logic.
Anonymous
I got admission in an institute but I can't understand my teacher. I asked this Question again and again and he tells me again and again but I can't understand. Because he tell me the code but I want to learn logic. If he tell me the logic and then I'll solve write the code for pyramid and other shapes like diamond etc.
Anonymous
I want to learn the logic not to read/write the code. If I learn the logic then i'll write the code using my mind.
Roshan
Anonymous
Ok
Makgato
Hello guys i need , i on how can i code program that have sockets for clients and server? I tried to check it via YouTube but i didn't find
Makgato
I need to know it in C++
Roshan
https://youtu.be/2hNdkYInj4g
Roshan
Maybe this has it. *I've not watched
Anonymous
👍
Makgato
👍
Thanks i will go through it
ברני
Hey... I made an easy code on c and I got a small problem that I dont get... the first symbole don't count and I don't understand why...
ברני
https://onlinegdb.com/SJ13suiiv
Roshan
ברני
Roshan
Get it?
ברני
I tried it already, the code won't work if iill remove the outside or the inside
Merry
hey, trying to build matrix-rotate function but i don't understand how to do that. Even tried to look it up on YouTube but i found only one and didn't understood it (the rest were about rotate the matrix in 90 degrees, which i don't need)
Any help?
Roshan
Apk
ברני
It works when I remove the out side scanf on other compilers but not on VS
Apk
Roshan
It works when I remove the out side scanf on other compilers but not on VS
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
char symbols = 'f';
int a = 0;
while (symbols != 'Q')
{
cin >> symbols;
switch (symbols)
{
case '+':
a++;
break;
case '-':
a++;
break;
case ':':
a++;
break;
case '.':
a++;
break;
case '*':
a++;
break;
default:
printf("\nWrong symbols");
break;
}
}
cout<<a;
}
Roshan
Roshan
Maybe it's some problem with C, IDK
ברני
ברני
olli
Roshan
Roshan
olli
Your solution is fine, it works! (Just wanted to point out that it always prints "Wrong symbol" before exiting, that you could fix by adding a case 'Q': break;)
I would probably do it like this
while(1) {
scanf(" %d", &symbol);
if (symbol == 'Q') {
break;
}
switch (symbol) {
// ...
Roshan
ברני
Roshan
꧁༒ 9H4WK ☬꧂
ברני
Кто-то
Hello. i have an assignment. Could somebody help where i made a mistake? I wrote my solution but it isn't right. But for examples it fit.
B
Can someone help me with entering data from the user in file in c++?
Roshan
ברני
Hey again.. How do I devide 2 numbers by using minus only?
Blue
Vitalii
double calc(int arr[], int len)
{
if(len>=0)
{
return 1.0/(arr[len-1]+calc(arr, len-1));
}
else
{
return 1;
}
}
Sorry, can anyone explain what I do wrong when I calculate expression 1/(b1+1 /(b2+1/(b3+1/(b4+...+1 /(bn−1+1/bn)...)))), using recursion?
Vitalii
arr - my array with numbers entered from keywords, len - size of array
Alex