Saro
Hi, which compiler do you use?
Дон
Shutz
Hello friends
Shutz
My blockchain is no buging how can I fix it please
Pavel
char* is generally a c-string, there's a separate type exists std::byte to represent a byte in latest standards
Shutz
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
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";
}
Anonymous
Adaita (MedTech | Healthcare)
Talula
VantaSoft
Kriss
Kriss
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
Kriss
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)
Adaita (MedTech | Healthcare)
Light
Adaita (MedTech | Healthcare)
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?
Дон
Pavel
VantaSoft
Anonymous
Hello Everyone, I want to learn C++ and I don't know where to start. Could you please help?
Дон
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.
klimi
Pavel
Pavel
I'm surprised this code compiles
klimi
B421036_Prerna
Ooo ok
klimi
char can only hold 0-255, 1 byte, not whole word
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
B421036_Prerna
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
Дон