coal
Anonymous
ok, do you know a place where I can
coal
coal
Anonymous
 I am trying to return true if a sub-array exists at given index (idx), false otherwise. For example:
if idx = -1, return false since data[-1] is out of bounds
* if idx = 0, return true since data[0] refers to the first sub-array
* if idx = 1, return true since data[1] refers to the second sub-array
* ...
* if idx = data.length - 1, return true since data[data.length - 1] refers to the last sub-array
* if idx = data.length, return false since data[data.length] is out of bounds
*/
Distac_221
ooh thank you everyone, now i find the solution. instead of if(strlen(str) == 0) its work with if(strlen(str) < 2) because enter was still input after all 😅
thank you @coalio @freakyLuffy @K11M1
Anonymous
O(n)?
Anonymous
determine the time function T(n) of the program then you can find the function complexity
Anonymous
@mtermu
Anonymous
you can graph 0.00001 n^2 and 1000n+2 and see that 0.00001 n^2 will eventually upperbound it
Pavel
Anonymous
yeah about what
coal
Anonymous
I have 3 problems that i am not able to solve
Anonymous
Can someone help me with them?
Harsh
Hash code hints do
Harsh
Plsz
Anonymous
I tried solving them but not able to get the correct output
Harsh
Harsh
Source code*
Distac_221
bwoah, now its segmentation fault. need your help bro
pastebin.com/SvWyqThj
Anonymous
Does anyone have c++ notes that he made?
Michel
Are class and struct only different in the default visibility? Or are there more differences?
Sarfaraz Stark
Can anyone explain what the benefits of operator Overloading and how it work
Kevin
I have a problem with a very large two-dimensional matrix, and segmentation faults (core dumped), they told me that it is possible to solve it by dynamically allocating the memory, with malloc, I have found various solutions on StackOverflow but to no avail.
Would anyone know how to help me?
Kevin
We are talking about 25 / 30mbyte
\Device\NUL
coal
coal
and the op is using it for C++
Distac_221
Distac_221
Anonymous
A dynamic array is an array whose size is only known during the runtime of a program. You can use the following two functions, malloc() or calloc() to define dynamic arrays. A strict sawtooth array is an array where the values of the sequence of elements should follow the up-down principle. The successive elements of the array should not be the same. The suc- cessive differences across the array should follow alternate +ve and -ve values. For example (1,4,2,5,4,8,6,10,9) and (-10,-15,0,-2,6,3) are strict sawtooth arrays of size 9 and 6, respectively, but (1,5,7,3,6) and (34,23,23,44) are not strict sawtooth arrays. In this program you have to use the concept of dynamic arrays to perform the following tasks with respect to sawtooth arrays.
• Prompt the user to enter the size of the array as ‘n’. Declare a dynamic integer array of the same size.
• Take input ‘n’ different integers into the array from the keyboard.
• Check if the array is a sawtooth array or not. Use the function int isSawtooth(int *) that takes as argument a pointer to the array and returns 1 if the array is sawtooth, otherwise it returns 0. Print the appropriate message on the console.
• If the array is NOT a sawtooth array, then find out the first position in the array where the sawtooth condition is violated. Use the function void position(int *, int *) which takes in two pointer arguments, first one is the pointer to the array and the second one a pointer to another integer variable declared in main. The position where the sawtooth condition is violated is written into the variable pointed by the second argument (Note that this function should NOT return the position). Also this function should be called only if the array is not sawtooth.
1
• The program then frees the dynamic array created. It asks whether the user wants to continue again or not. It prompts the user to input ‘Y’ (for Yes) or ‘N’ (for No) to continue the program. If ‘Y’ is entered, then the steps are repeated again and if ‘N’ is entered, the program exits. The array has to be dynamically allocated each time the program runs.
Anonymous
help me with this problem
Anonymous
in this I am not able to find the position function
\Device\NUL
gcc compiles both C and C++
gcc and g++ are diffrent i think. Maybe the OP compile C++ using gcc but he/she forgor to give -lstdc++ parameter
Hussein
I am trying to solve my assignment but it is too hard please can you solve it the assignment is to input a number between 100 and 999 using c++
Thank you😍
klimi
Hussein
Why
\Device\NUL
Why
Because it's easy
Prometheus
Hussein
First time learning c++
Hussein
I only know if and else
Hussein
They said to me to use loop 😟
klimi
your request doesn't sound that you want to learn. it seems that you just want us to make the work instead of you
Hussein
No bro
Prometheus
\Device\NUL
Loop is in basic programming
coal
if you have questions because you tried to solve it but you have an error, then you can ask
coal
but you also have to engineer the function by yourself, especially in something so simple that you could find it in google in 10 minutes
Nana
pls what frame work is good gor c++ GUI
coal
klimi
gtk, qt, imgui
\Device\NUL
coal
lol
Nana
Okay, thank you guys
Nomid Íkorni-Sciurus
Hi. I'm trying to use SDL2 as a dependency in Meson, but linking fails because it can't find SDL2.lib.
Nomid Íkorni-Sciurus
at the end of compilation, it says LINK : fatal error LNK1181: can't open input file 'subprojects\SDL2-2.0.18\sdl2.lib'
SCouT9
Is there anyone who can help me with this problem 😐
Suppose😷 you have a cubic shaped container full of water and the height of that container is h.
You accidentally dropped a metallic ball that has a radius of r (where r<h) and v volume of water
overflowed from the container.
Write a C program that takes h and r as input and displays the volume of water that overflowed.
Sample input: 10 5
Sample output: 607.30
SCouT9
Am just a biginner
Thanks in advance
klimi
if i needed some snippet of code i used google
Sathiya
Distac_221
100$ website
i have written a code, to convert digit into words
to 1-100
i wanna make it infinity
like if user input 3000, 4560?
also when i write 30 it return 30 d
100$ website
#include<iostream>
using namespace std;
int main()
{
int number,a1,a2;
char array1[][10]={"one","two","three","four","five","six","seven","eight","nine","ten"};
char array2[][10]={"eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"};
char array3[][10]={"twenty","thirty","fourty","fifty","sixty","seventy","eighty","ninty","hundred"};
cin>>number;
{
if(number<0)
cout<<"the number is negative number";
else if(number>0 && number<=10)
cout<<"the number is "<<array1[number-1];
else if(number>10 && number<20)
cout<<"the number is "<<array2[number-11];
else if(number>=20 && number<=100)
a1=number/10;
a2=number%10;
cout<<"the number is "<<array3[a1-2]<<" "<<array1[a2-1];
}
return 1;
}
100$ website
can someone help me here?
coal
coal
#include<iostream>
using namespace std;
int main()
{
int number,a1,a2;
char array1[][10]={"one","two","three","four","five","six","seven","eight","nine","ten"};
char array2[][10]={"eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"};
char array3[][10]={"twenty","thirty","fourty","fifty","sixty","seventy","eighty","ninty","hundred"};
cin>>number;
{
if(number<0)
cout<<"the number is negative number";
else if(number>0 && number<=10)
cout<<"the number is "<<array1[number-1];
else if(number>10 && number<20)
cout<<"the number is "<<array2[number-11];
else if(number>=20 && number<=100)
a1=number/10;
a2=number%10;
cout<<"the number is "<<array3[a1-2]<<" "<<array1[a2-1];
}
return 1;
}
you cant make it infinite, but you can restructure this so it looks nicer