olli
So there is no such way to access for dynamic?
correct - again, you need to know the size and the starting address to access the last element.
Azhar
correct - again, you need to know the size and the starting address to access the last element.
What if size is given 10 but array having only 6 elements and also know base adress 1000
Azhar
How can i access than
olli
What if size is given 10 but array having only 6 elements and also know base adress 1000
the size of the array does not change, no matter how many elements you have in it. If you want to get the last element you put in, you need to keep track of that as well.
Azhar
I can message u screenshot?
Prince Fine
I have a question
Prince Fine
I create a data type using struct and i asked the user how many people data is going to be stored then (int no;) I use for (int i=1;i<no;i++) Cout<<" "; Cin.getline(sol.name,24)[i]; Do i need to include i?
Prince Fine
olli
Others wont change ? Cin getline(sol[i].name,24);
in this case you change the name of the i-th person
Prince Fine
in this case you change the name of the i-th person
#include <iostream> using namespace std; struct eyuel { char name[25]; int age; float weight; }; int main() { int no,i; eyuel sol; cout << "how many Owner files do you want to create? "; cin >> no; for ( i = 1; i <= no; i++) { cout << "Enter The name of the Owner: "; cin.getline(sol[i].name, 24); cout << "\n Enter the age of the Owner: "; cin >> sol[i].age; cout << "\n Enter the weight of the Owner: "; cin >> sol[i].weight; cout << "\n name : " << sol[i].name << "age : " << sol[i].age << "Weight : " << sol[i].weight<< endl; } return 0; }
Prince Fine
it says error: no match for 'operator [ ] ' (operand types are 'eyuel' and 'int' )
Prince Fine
so what do you sugest
olli
so what do you sugest
Create a vector that holds no many eyuel objects.
Mustapha
I need a C++ program that will read Fibonacci series plz
coal
can you elaborate on it
Mustapha
read?
Yeah
Mustapha
can you elaborate on it
I mean that can run without error
Mustapha
I hope you undetstand now
olli
Ashwani
Java project ideas for beginners Anyone?
Talula
Ashwani
Ok ok
olli
#include <iostream> int main() { int input; while (std::cin >> input, input) { std::cout << "Received input: " << input; } return 0; }
while this might work in your case, it does behave different, only the second condition is checked. e.g. this is an endless loop while(0, 1) {}, while this one never executes while(1, 0) {}
Nana
What project do you have in mind?
Nana
#include <iostream> #include <string> #include <sstream> using namespace std; string replaceString(string string1, string string2, string string3) { string result; // Create a string stream for parsing stringstream stream(string1); string temp; // Tokenizing w.r.t. space ' ' while (getline(stream, temp, ' ')) { if (string2 == temp) { result += string3; } else { result += temp; } result += ' '; } return result; } int main() { string string1; string string2; string string3; cout<<"Enter string1: "; getline(cin, string1); cout<<endl; cout<<"Enter string2: "; getline(cin, string2); cout<<endl; cout<<"Enter string3: "; getline(cin, string3); cout<<endl; string replaced = replaceString(string1, string2, string3); cout << replaced; return 0; }
Nana
#include <iostream> #include <string> #include <sstream> using namespace std; string replaceString(string string1, string string2, string string3) { string result; // Create a string stream for parsing stringstream stream(string1); string temp; // Tokenizing w.r.t. space ' ' while (getline(stream, temp, ' ')) { if (string2 == temp) { result += string3; } else { result += temp; } result += ' '; } return result; } int main() { string string1; string string2; string string3; cout<<"Enter string1: "; getline(cin, string1); cout<<endl; cout<<"Enter string2: "; getline(cin, string2); cout<<endl; cout<<"Enter string3: "; getline(cin, string3); cout<<endl; string replaced = replaceString(string1, string2, string3); cout << replaced; return 0; }
replaceSubstring Function Write a function named replaceSubstring. The function should accept three C-string or string object arguments. Let’s call them string1, string2, and string3. It should search string1 for all occurrences of string2. When it finds an occurrence of Programming Challenges 595 string2, it should replace it with string3. For example, suppose the three arguments have the following values: string1: “the dog jumped over the fence” string2: “the” string3: “that” With these three arguments, the function would return a string object with the value “that dog jumped over that fence.” Demonstrate the function in a complete program.
Anonymous
get cbook
.
Real Time detection letter from keyboard and targeting of robotic arm. More details and source code you can read hear : https://arobs.com/blog/robotic-arm-how-to-create-an-intelligent-robotic-system-that-types-autonomously/
Crooked
class sumset{ public: sumset(); class sum{ public: friend const sum operator +(sum &obj1,sum &obj2); int get_a(){ return a; } sum(int n1):a(n1){ } private: int a; }; private: sum *arr; }; How can I find sum of two number in nested class using operator + . sumset keeps in private part sum *arr that keeps sum element.(So example in main sumset s1,s2; find s1+s2)
Ludovic 'Archivist'
Okay. Pls copy and paste it in your ide and try if you can indent it to understand the code
I do understand it perfectly, I am trying to help you, not myself
Ludovic 'Archivist'
Pls help me with your code
No, best I can do is to give you hints to understand your assignment better
Nana
No, best I can do is to give you hints to understand your assignment better
I've tried using the replace library but it's does not work
Ludovic 'Archivist'
I've tried using the replace library but it's does not work
read the code carefully, play it out on paper, use cppreference.com to check standard library features
Anonymous
@QNeko Dear admin can we ask our test question in this group
Talula
@QNeko Dear admin can we ask our test question in this group
You can if you don't say it's your test question...
Anonymous
You can if you don't say it's your test question...
Are you group admin or moderated I am new IDK
Talula
Are you group admin or moderated I am new IDK
No, but I'm here for 3+ years.
Ludovic 'Archivist'
Tazz has been there about as long as I, she is not moderator, but quite close to it. She is a quasi-moderator, a Quasimodo if you will
Ludovic 'Archivist'
You will learn very little from YouTube, I advise using a book
Ludovic 'Archivist'
If you still want to use videos, my advice is to use something like annotate.tv to... Annotate the videos with extra info and with every point you don't understand well enough to explain with your own words
Anonymous
Print the numbers between 100 to 200 which are completely divisible by 3 and 5.
Anonymous
Anybody please answer this I am trying but not getting it
Anonymous
Do this group have any instagram account
Talula
Anybody please answer this I am trying but not getting it
That isn't how it works, you have to post your code and if it needs a small correction we would help you out... We are not here to solve your problems.
Anonymous
OK let me upload my code
Anonymous
#include<stdio.h> int main() { int i; for(i = 100; i <= 300; i++) { if(i%3 == 0 & i%5 == 0) { printf("%d\n",i); } } return 0; }
Anonymous
@Tazmikar Now pleasee
Azhar
What happen when we assign a same pointer with different address even it declared earlier?
Talula
@Tazmikar Now pleasee
Seems to work fine... what is the problem?
Anonymous
Seems to work fine... what is the problem?
Actually see question I don't think it's correct acc. To it
Anonymous
Anonymous
Now working
Talula
It worked with single & too...
Anonymous
Print the numbers between 100 to 200 which are completely divisible by 3 and 5.
#include <stdio.h> int main() { for (int i = 100; i <= 200; i++) { if (i % 3 == 0 && i % 5 == 0) { printf("%d\n", i); } } return 0; }