fluffy
Hi
Ayaan
Write a program to print the following pattern using nested loop. 1 2 3 4 5 2 3 4 5 3 4 5 4 5 5
Alfredo
Help 🥺
Read the pinned message.
Anshul
Try it first.
In your profile pic, which language it is 😅
Ayaan
Try it first.
Did not happen
@𝑺𝒐𝒃𝒌𝒂
Apk
It's not just coming that way
show what you tried then only someone would be able to help
Ayaan
show what you tried then only someone would be able to help
{ int n = 5; for(int i = 1; i <= n; i++) { for(int j = n - i; j >= 0; j--) { cout<<j<<" "; } cout<<endl; return 0;
Ayaan
Write a program to print the following pattern using nested loop. 1 2 3 4 5 2 3 4 5 3 4 5 4 5 5
Anshul
And also you want to print from 1 to 5 not 5 to 1
Anshul
Waah kya naam h 😂👍
Ayaan
did it work
Wait bro i gonna check
Ayaan
did it work
Not work
Ayaan
did it work
#include<iostream> using namespace std; int main() { int n = 5; for(int i = 1; i <= n; i++) { for(int j = i; j >= 0; j--) { cout<<j<<" "; } cout<<endl; }}
@𝑺𝒐𝒃𝒌𝒂
Still not working
#include <iostream> using namespace std; int main() { for(int i = 1; i <= 5; i++) { for(int j = i; j <= 5; j++) { cout<<j<<" "; } cout<<endl; } return 0; }
@𝑺𝒐𝒃𝒌𝒂
Mar!o
https://github.com/MarioSieg/ExtendedVariant If anyone is interested, I'm currently writing a tiny single header library - an easy to use and clean alternative to std::variant and I'm looking for contributors. It makes using variants much cleaner and nicer and it allows for more customization if needed. No more std::holds_alternative or std::visit with functor structs or verbose lambdas! It still supports the STL interface like std::variant so it works as a drop in replacement too.
.
Why am I getting an error?
.
int main() { int primos por mostrar, n, d; int es primo; printf("Cuantos primos desea mostrar: "); scanf("%d", &primos por mostrar); n = 2; while (primos por mostrar > 0) { /* determinar si n es primo */ es_primo = 1; for (d = 2; d < n; ++d) { if (n % d == 0) { es_primo = 0; break; } } /* mostrar el numero * y actualizar el contador */ if (es primo) { printf("%d ", n); primos por mostrar--; } n++; } printf("\n"); return 0;
.
In the int
@𝑺𝒐𝒃𝒌𝒂
Why am I getting an error?
The name of some variable doesn't match with the rule. No whitespace is allowed. Instead of primos por mostrar, es primo, you should write primos_por_mostrar/primosPorMostrar, es_primo/esPrimo.
Anonymous
thanks
Anonymous
You forgot "return" before check(arr,n-1) in the else part.
B121065_Swoyam Siddharth Nayak
ohkay
B121065_Swoyam Siddharth Nayak
the problem is solved, thank you
Anonymous
ohkay
If you delete your message after asking a question, it will just make my answer meaningless
B121065_Swoyam Siddharth Nayak
B121065_Swoyam Siddharth Nayak
sorry
Hanz
bruh
Hanz
that is unfortunate, but the keyword "answer is wrong" mean something for me 🤔
TechGuy
hi
Anonymous
how can i call the constructor of a base class without having to declare it explicitly in its derived class?
Diego
You can't
Anshul
You have to make a new constrictor in derived class. Because then only you can initialise the derived class members
Anshul
Else compiler will make default constructor and the base class constructor will be called by this default constructor itself
Anonymous
eg class A { public: A(int unused); } A::A(int unused) {}; class DERIV: public A {}; // candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided DERIV x = DERIV(5);
Anshul
Because derived class default constructor can call only default constructor of base class
Anonymous
🙁
Anonymous
welp i came up with this #ifdef CORRADE_TARGET_ANDROID #define CRAFTER_PACKAGE_CONSTRUCTOR_WRAPPERS_CPP(class_, className) #define CRAFTER_PACKAGE_CONSTRUCTOR_WRAPPERS_HPP(class_) #else #define CRAFTER_PACKAGE_CONSTRUCTOR_WRAPPERS_CPP(class_, className) class_::className(const Magnum::Platform::Sdl2Application::Arguments &arguments) : Crafter::Package{arguments} {} #define CRAFTER_PACKAGE_CONSTRUCTOR_WRAPPERS_HPP(class_) explicit class_(const Magnum::Platform::Sdl2Application::Arguments &arguments) #endif class Draw_Color : public Crafter::Package { public: CRAFTER_PACKAGE_CONSTRUCTOR_WRAPPERS_HPP(Draw_Color); void drawEvent() override; }; CRAFTER_PACKAGE_CONSTRUCTOR_WRAPPERS_CPP(Crafter::Packages::Draw_Color, Draw_Color) void Crafter::Packages::Draw_Color::drawEvent() { swapBuffers(); GL::defaultFramebuffer.clear(GL::FramebufferClear::Color); }
Anonymous
so i do not have to copy ifdefs to all my classes and cpp files
Top most
Can anyone please tell me the best youtube channel related to c++
Pavel
Can anyone please tell me the best youtube channel related to c++
If "the best" then I would say https://youtube.com/user/CppCon But this one about advanced stuff
Aida Ataee
How can I write dot product of triangonantic function of 2 array in C?
Anonymous
How can I write dot product of triangonantic function of 2 array in C?
I have heard of dot product of vectors. What is dot product of triangonantic function
Aida Ataee
dot product?
yeah like x.y
Anonymous
dot product or inner product
I know what dot product or inner product is in vector spaces. I want to know what triangonantic functions are
Aida Ataee
I know what dot product or inner product is in vector spaces. I want to know what triangonantic functions are
question is : write a program in c for dot product of sin(arg) and cos(arg)
Anonymous
question is : write a program in c for dot product of sin(arg) and cos(arg)
The question seems to be wrong. Sin and cos are both scalar quantities and hence ther cannot be any inner product defined on them.
Anshul
It'll be helpful to understand if you show the question
Anonymous
even if we consider in array?
So you are given two arrays of sin and cos values and you want to find the dot product of those 2 arrays?
Anonymous
yes
sum = 0.0 for i in 1 to array.size sum += cosarr[i] * sinarr[i]
Ausir
Hi guys, may i put different type of messages in the same message queue?
Pavel