Saro
Hi, which compiler do you use?
Shutz
Hello friends
Shutz
My blockchain is no buging how can I fix it please
Pavel
Some kind of magic? Even in the case of void* it is not quite clear to me
Operator << for ostream (I guess it's ostream) is overloaded for different types. You change the type, you use another overload of the operator
Pavel
char* is generally a c-string, there's a separate type exists std::byte to represent a byte in latest standards
VantaSoft
Hi. There is project that made with c++ 14 I want to use it in my visual c++ 6.0 project Can someone guide me please? I can pay if someone can implement this project with visual c++ 6.0.
Talula
I called it vm to be able to mention JVM is also in C
You can write JVM in any language... And most of the stuff is written in C++ because it is C with added features that makes programming easier.
Kriss
so i wrote this code to check for palindrome but my code is giving output as 0 and 1 instead of true and false
Kriss
#include <iostream> // Define is_palindrome() here: bool is_palindrome(std::string text){ std::string new_st; for(int n = text.length()-1; n >=0; n--){ new_st.push_back(text[n]); } if(new_st == text){ return true; } else{ return false; } } int main() { std::cout << is_palindrome("madam") << "\n"; std::cout << is_palindrome("ada") << "\n"; std::cout << is_palindrome("lovelace") << "\n"; }
VantaSoft
Why VC++ 6.0? Writing for Windows NT or something?
Idk it's part of a project that requested by my customer and he asked me to write it with visual c++ 6.0
VantaSoft
Why VC++ 6.0? Writing for Windows NT or something?
Is that possible to implement a c++ 14 program with visual c++ 6.0 ?
labyrinth
i am defining a priority queue of user defined class in a class in a header file, the pq requires a custom comparator in order to function well, but I dont want the comparator be visible to other entities that include the header file, are there any workarounds?
Adaita (MedTech | Healthcare)
I will do that when I will learn more
👍🏼 Here is the modified one just for your reference: bool is_palindrome(std::string text) { auto b = text.cbegin(); // O(1) auto e = text.cend()-1; // O(1) // O(n/2) traverse halfway or less for(; b < e; ++b,--e) { if(*b != *e) break; } if(b == e || *b == *e) { return true; } else { return false; } }
Anonymous
i am defining a priority queue of user defined class in a class in a header file, the pq requires a custom comparator in order to function well, but I dont want the comparator be visible to other entities that include the header file, are there any workarounds?
With modules you can do it easily. But before C++20, unfortunately there is not much in the way of support for this. At best, you can hide the implementation of the comparator from clients. But the interface will be exposed.
Light
Hi Everyone. I am new here. I am studying Computer Science & Engineering. I want to learn C from beginner to advanced level.I know the basics of python. Can you share few good resources / course so that I can learn by myself without wasting my time? I have googled but there are too many resources it is very hard to choose.I want to know which course helped you the most.
Adaita (MedTech | Healthcare)
This is C++ not C !
Oops, my bad!
Shahriar
Help me 🙄
🇳🇵 𝑍𝑒𝑦𝑙𝑎𝑥 𝑗𝑜𝑛𝑗𝑜 🇳🇵
write a program to concatenate two string(name and address of a person) using the concept of containership
Mariam
Hello everyone Can you help me i am learning at univercity c++,but now i want to improve mu skills so what you suggest me what i do?
Anonymous
Hello Everyone, I want to learn C++ and I don't know where to start. Could you please help?
Anonymous
https://t.me/programminginc/464787
Instead of pointing to specific messages in that group you can just use #res to point to the group itself
B421036_Prerna
#include<stdio.h> #include<stdlib.h> int main() { int a,r; scanf("%d",&r); while(r>0) { scanf("%d",&a); char arr[a]; int count =0,key=0; for(int i=0;i<a;i++) { scanf("%s",&arr[i]); } for(int i=0;i<a;i++) { if(arr[i]=='START38') { count++; } if(arr[i]=='LIME108') { key++; } } printf("%d %d",count,key); }return 0; }
B421036_Prerna
can anyone tell where am i wrong?
B421036_Prerna
i have to find the number of time start38 and lime108 are coming the array.
B421036_Prerna
this compiles without warnings?
It is showing a warning Character constant too long for its type
Pavel
I'm surprised this code compiles
B421036_Prerna
Ooo ok
klimi
char can only hold 0-255, 1 byte, not whole word
B421036_Prerna
char can only hold 0-255, 1 byte, not whole word
Ooo So for taking string data type what should i do as c language doesn't provide an inbuilt data type for strings
Saro
Which compiler do you use?
VantaSoft
When a header file is not available in old version of c++ can I do something about it without upgrading my project c++ language version?
Saro
Have you seen this https://social.msdn.microsoft.com/Forums/en-US/bfcffb6d-7abc-422a-8ab9-509f2403b106/fatal-error-c1034-stdioh-no-include-path-set?forum=vcgeneral ?
klimi
Ooo So for taking string data type what should i do as c language doesn't provide an inbuilt data type for strings
you will have to compare each char in both strings or use built in function for that like strcmp
klimi
Ok thanks
you're welcome
Дон
I think you can cast to void* with static_cast or just (void*)addr
It is valid if I use like this: (void*) (end - begin); But this is invalid: static_cast<void*>(end - begin); Valid form: static_cast<long>(end - begin); What is the name of this behaviour, what can I watch about this topic?
xXLx**Xx
hello everyone. I just want to ask for help about my c++ code
xXLx**Xx
int main() { int p=0, c=0, total=0, n; do{ cout<<"Enter a positive number: "; cin>>n; if(n==0){ break; } for(int i=2;i<n;i++){ if(n%i==0){ total++; } if(total==0){ p++; } else{ c++; } } } while(true); cout<<"Prime: "<<p<<endl; cout<<"Composite: "<<c; return 0;
xXLx**Xx
i nedd to count the prime and composite numbers as per the instruction
xXLx**Xx
output should count the prime and composite number, but i am getting incorrect outputs
xXLx**Xx
input must be: 11 13 17 31 39 47 0
xXLx**Xx
and output must be: prime is 5, composite is 1
Дон
Your code thinks 0 it's not composite
xXLx**Xx
yeah, I think the purpose of it is to terminated the code, since it is a loop
Дон
I think your code is completely wrong at the algorithm level. Better make separate counting functions.
Дон
If you know the algorithm, run your code in a debugger and look for errors
xXLx**Xx
I know nothing about these stuff actually.
xXLx**Xx
that's why i am having a hard time doing this activity in one of my subjs
Дон
You can google it, it's a popular task
xXLx**Xx
already do that, flipped the internet up-side-down looking for guide but i found nothing
xXLx**Xx
guides that are avilable on google pertains only on how to know if a number is prime or composite
Дон
https://stackoverflow.com/questions/17801360/counting-prime-numbers-in-c
Дон
You can put this code in the is_prime function
Дон
Then use a loop to n in the main function, calling this bool function each time and increasing the p counter depending on the result. At the end, c = (n - p)
Дон
You' re looking for positive numbers, so use type size_t instead of int
xXLx**Xx
i'll try it. thanks much for the help and all.
Anonymous
Can someone explain how "while" statements work
Дон
Can someone explain how "while" statements work
What is the problem to google it? It's basic topic