Vlad
You can't return pointer to VLA array
Vlad
It is destroyed after the end of scope
Michel
How can I check If one of the argv equals some predefined char string?
G
how to use line in parameter
while ((getline(&line, &len_host, fhost)) != -1)
{
curl_easy_setopt(curl, CURLOPT_URL, line);
G
the parameter receives char*
Anonymous
Anonymous
Anonymous
'''int main(int argc, char *argv[])
{
// input calculador do tit
cout << "Que valor tens?";
int escolha;
int tit = 0;
int tilp = 0;
int tip = 0;
do{
cout << "Que valores tens?\n 1.Tit\n 2.Tilp \n 3. Tip \n 4. Calcular valor em falta\n";
cin >> escolha;
switch(escolha){
case 1:
cin >> tit;
break;
case 2:
cin >> tilp;
break;
case 3:
cin >> tip;
break;
case 4:
tit = tilp + tip;
cout << "Tit :" << tit << endl << "Tip:" << tip << endl << "Tilt:" << tilp << endl;
case 5:
cout << "Programa encerrado" << endl;
break;
}
}
while(escolha != 5);
}'''
Why is this not working I wanna give 2 inputs at any given time and then press 4 to print all the values but it never hits right
Anonymous
Anonymous
Anonymous
Hi.
Are linkedin courses worth it?
Please check the message above. Those are the only recommendations we are making. If you need info on anything outside of that, you will have to do your own research.
And in future, please stick to asking questions only related to C and C++ in this group
Anonymous
Anonymous
Suppose if size of integer is of 4 bytes in our computer then using short in front of integer makes it of 2 bytes but on the other hand using long as modifiers in front of integer allows integer data type to take more memory space. Can anyone please explain how it will take more memory when system itself is size of integer as only 4 bytes ?
Anonymous
and one more why error is shown in my system when I use %d format specifiers to the sizeof operator but the error will get resolved if I use %ld
Phil
Sonny
Hi guys random question about class constructors. If I have a class and I don't set up any specific constructors, do I still need to declare them? Class::Class()=default; or is it okay to just leave them out all together? what's the best practice?
Alviro Iskandar
Sonny
thanks
Igor
Hello, guys! Has anyone worked with https://github.com/tesseract-ocr/tesseract. I am wondering how to setup a config to properly recognize text on image. Right now, ocr recognize only one piece of text, but not all. Can't send media file unfortunately
Teatro
hello. how can i asiggn a word in another line? this don't work
main () {
char a[5];
a="asdd";
cout <<"end"<<a;
}
\Device\NUL
\Device\NUL
In linux lp64 while windows llp64. The only way to make it portable is using (u)intX_t from stdint
\Device\NUL
\Device\NUL
\Device\NUL
You shouldn't mix C++ stuff with C stuff
Teatro
Get it👍
Nawras
I have a program that when i enter a string like character (a) i get it in ascii number and i get the length of it so i want to put the ascii number by the length , for example number 3 the length is 4 so it printf(“s”,result) the output will be (3333)
Nawras
How can i make this work i found the length and the asci number but can put it in array and put it into the (result)
\Device\NUL
Nawras
Lets say you have string and length
Nawras
You want to make array that it multiple the string for length times
Nawras
And make this another string to print it
\Device\NUL
Nawras
Can i send you the question translated
\Device\NUL
printf("%.3s", "abcde")
The output is only abc because the max field width is 3 char
Pumpkin
#include <stdio.h>
int main()
{
int a;
printf("this is %d\n", a);
}
Hello,
Why this variable 'a' defaults to 0 here?
Anonymous
compiler usage to maintain int =0
Vlad
Vlad
Reading uninitialized variables is undefined behavior
Vlad
Vlad
MSVC would fill it up with 0xcccccccc memory pattern
Anonymous
Pumpkin
Pumpkin
Anonymous
Pumpkin
Achille
hi everyone , I hope you're doing well ! I would like to send email in my Qt c++ app , someone have a suggestion for me ?
Batista
Anonymous
Ольга
Good day. Sorry to bother you but I do not understand why in this program when entering the title of a book consisting of two words is remembered only the first. I will be glad for any help
https://onlinegdb.com/qn-mJL0v4
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
please tell me if I'm wrong, so I won't make the same mistake again
Ольга
Fenimoure
Ольга
Good evening. I can't understand what's wrong again, at what point something goes wrong. I will be grateful for any help
https://onlinegdb.com/CV4ybR4Yq
Anonymous
Fenimoure
Csc's Saitama
Good day
מנחם
while(num--)
I know when a number reaches zero, the condition is false.
But what happens if the number is negative? For me it keeps running.
-1 are true?
Vlad
מנחם
\Device\NUL
\Device\NUL
Non Zero value will treated as true
Vlad
However why won't you just return true?
Fenimoure
Artur
Anonymous
Iwan
Hi guys. can anyone help me to get the answer "Exactly! Good job."
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
static int64_t the_rolling_stones[] = { 94481, 91226, 95774, 30622, 75165, 72293 };
const static int N = sizeof(the_rolling_stones)/sizeof(*the_rolling_stones);
static void fail(){
puts("Nope!");
exit(EXIT_FAILURE);
}
static void aerosmith(int64_t e, int64_t o, int64_t u){
if ( e - u / 7 + 3 * o / 11 )
fail();
}
static void green_day(int n, int64_t v){
if (n<N) {
if ((n % 2) == 0)
green_day(++n, v);
else green_day(n + 1, v + the_rolling_stones[n]);
} else if (v != 213806)
fail();
}
static void anthrax(int b, int64_t x){
int64_t k = x;
for(; b<N; ++b) {
if (b % 2)
continue;
k *= the_rolling_stones[b];
}
if (k != 849419606)
fail();
}
int main(){
int64_t y, f, c;
printf("Please enter the right three numbers: ");
fflush(stdout);
if (scanf("%" SCNd64 " %" SCNd64 " %" SCNd64, &y,&f, &c) != 3)
fail();
the_rolling_stones[0] = y;
the_rolling_stones[5] = f;
the_rolling_stones[4] = c;
green_day(0, 90385);
anthrax(1, 7);
aerosmith(y, f, c);
puts("Exactly! Good job.");
}
-248 1573 1267
️Skill
is this code correct?
Book::~Book() {
delete[] this->_name;
delete[] this->publisher._name;
delete[] this->publisher._version;
}
Book::Book(const Book &copy) {
size_t len = wcslen(copy.name());
_name = new wchar_t[len+1];
wcscpy_s(_name, sizeof(wchar_t) * len, copy._name);
because i'm keep getting Exception 0xc0000005 encountered at address 0x7ffd90aa609b: Access violation reading location 0xffffffffffffffff at deleting _name