Chris Ashley
Need a little help here guys. Tried to compile it and it said 'b' does not have type.
Danny
okay
Jasim
https://helperscript.com/udemy-paid-courses-video-free-to-download/
noop
Anyone? Please?
auto is part of C++ since standard C++11, so you should compile it with specifying the standard
Anonymous
ohh idk then
Anonymous
#include <stdio.h> int rec(int); int main() { printf("%d",rec(5)); return 0; } int rec(int n) { if(n<=1) return 20; return rec(n-1); }
Anonymous
Anyone explain this
noop
#include <stdio.h> int rec(int); int main() { printf("%d",rec(5)); return 0; } int rec(int n) { if(n<=1) return 20; return rec(n-1); }
rec is a recursive function, it calls itself. It has a stop condition: when n reaches 1 or less, it returns 20. Inside main function, rec is called with 5, then it calls itself with 4, then 3, then 2, and then 1. When n is 1, it returns 20 as output and that is the value printed
Mukkeen
Hello everyone I've searched Google but still don't understand the answer been gathered. How can i get my ip and network name through C? Can anyone make it more comprehensive for me
Anonymous
Anonymous
Watch my graphics design in c language
Anonymous
Wat
....?
Anonymous
Thank you
Anonymous
Already done 😄
Sadashiva
Agree
Anonymous
Anonymous
run it and see :/
klimi
undefined reference and other stuff
Anonymous
Answer is 41 but i want explanation
Asdew
Answer is 41 but i want explanation
What do you not understand?
noop
Answer is 41 but i want explanation
The first line creates a memory block of int and gives its address to p, so the value of p is the address of that int block. Assume that the value of p is something like this: 0x718155, which is an address. Second line, says that the value of that int block is 42. So, if someone goes to the address of 0x718155 and checks the value inside, it is 42. Third line creates another int-pointer (v) or address. v has the same value as p. Now both p and v have the value of 0x718155. Line fourth says that: go to the address of 0x718155, change its value to 41.
Anonymous
Why code blocks need std:: for running any c++ program and how to solve it
Anonymous
Cout<<"\n hello world:"; doesn't run But Std::cout<<"\n hello world:"; runs Why???
Anonymous
klimi
but in the other hand library <iostream> # input and output namespace there are functions to manage streams
Anonymous
because cout isn't c++ command, its not a syntax thing,
he probably used Turbo C where there were no namespaces and no STL
noop
Cout<<"\n hello world:"; doesn't run But Std::cout<<"\n hello world:"; runs Why???
It is not an error. You can type this using namespace std; after include parts, so you don't need to type std:: before cin and cout and endl and ...
Anonymous
Anyone here please give me a road map to become a successful software developer
Yash Ajitsaria
How to write a c program to reverse a 5 digit number
klimi
How to write a c program to reverse a 5 digit number
1. get a digit 2. put it in the new correct place 3. repeat
Yash Ajitsaria
Can you explain more . Please
klimi
Can you explain more . Please
no i can not, because its just that
Yash Ajitsaria
How to put the number in correct place
Yash Ajitsaria
I'm new in C programming..
klimi
eg if you want to reverse number 15 you take the 5 and place it into new number then you take 1 and put it after 5 so you have 51, congratulation
Yash Ajitsaria
Thanks
klimi
Thanks
clear now?
Yash Ajitsaria
Yep
Over-engineering
Can some explain me this code? if (s1.find(s2) != std::string::npos) { std::cout << "found!" << '\n'; } What does npos mean?
Mar!o
http://www.cplusplus.com/reference/string/string/npos/
Mar!o
I think it has some good stuff
Mar!o
At least it's enough to lookup a function or class
Mar!o
Yeah cppreference is better of course
Mar!o
http://www.cplusplus.com/reference/string/string/npos/
According to C++ 17 npos should be marked as constexpr which also is not the case above...
Ronak 🇮🇳
class Std_interface { public: virtual void start() = 0; virtual void suspend() = 0; virtual void resume() = 0; virtual void quit() = 0; virtual void full_size() = 0; virtual void small() = 0; virtual ~Std_interface() {} }; class Text : public Std_interface { vector<int> s; public: void start(); void suspend(); // ... virtual void print(); }; void (Std_interface::* pmi)() = &Text::print; void (Text::*pmt)() = &Std_interface::start;
Ronak 🇮🇳
?
Ronak 🇮🇳
ahan, the rule that says we can assign a pointer to a derived class to a pointer to its base class
Ronak 🇮🇳
void (Std_interface::* pmi)() = &Text::print; its wrong why?
Ronak 🇮🇳
okay.
Serenity
Hey guys
Serenity
Can somebody help me ?
I_Interface
Can somebody help me ?
dont ask for ask ask
Serenity
I am trying to write a function that gets a string of numbers and stores them in a 2D matrix.
Anonymous
thanks
Serenity
But when I call the function twice the values glitch into the second matrix with no special reason.
Serenity
The calls are distinct so how does it make sense ?
Serenity
It would be easier to explain with an example.
Serenity
void read_mat(int mat[][SIZE]) { int i, j = 0; char x; int flag = 0; for (i = 0; i < SIZE; i++) { for (j = 0; j < SIZE; j++) { x = getchar(); if (x == '0') mat[i][j] = 0; else if ((x == '\n') && (i < 5) && (j < 5)) { flag = 1; break; } else mat[i][j] = 1; } if (flag == 1); break; }
Serenity
I think it's related to the functionality of getchar()
Anonymous
so i read about abstract class. i was still thinking that Bulk_quote and Limited_bulk_quote would still need to look at the price (double) member (protected) of Quote and so I have to still look up the inheritance hierarchy, but then i found out that I can be explicit about the member in T using using
Serenity
Do you want me to show you the instructions so that you can understand what the code is about ?
Serenity
I pass in 2 different matrices
Serenity
the general idea of the task is to get two matrices from the user and apply some kind of matrix multiplication
Serenity
My issue is about getting them properly from the user
Serenity
The matrices have constant rows and columns (square matrices 5X5)
Anonymous
so i read about abstract class. i was still thinking that Bulk_quote and Limited_bulk_quote would still need to look at the price (double) member (protected) of Quote and so I have to still look up the inheritance hierarchy, but then i found out that I can be explicit about the member in T using using
now i have a new question? is it good or bad design to redeclare all accessible members of the base class in the derived class using using (obviously with appropriate access specification)? this would basically make the derived class a manpage for the base class
Anonymous
yes. but the price member (double, not function) of Quote will still be needed in Bulk and Limited for calculations