Anonymous
someone pls help me, I can't understand what's wrong in my code...
Anonymous
https://ideone.com/wjawud
here is the link of the code...
Anonymous
input format:
Anonymous
4 8
2 3
Kim
Thank you
Anonymous
when the uppper limit of inductance is odd like 0.00300, 0.00500 then the value of inductance is going upto 0.00275, 0.00475
Anonymous
but when the upper limit is 0.00200, 0.00400 then it working fine...
Anonymous
I can't understand why for 0.00300 <= 0.00300 it is giving false...?
Anonymous
Hello anyone pls help me...?
Anonymous
Anonymous
Anonymous
in https://gist.github.com/mgood7123/cdc84358bcac6560fe2fab6b10a37573 how do we know if we are still expanding, and when the expansion should be stopped?
Anonymous
rip noone knows about macro preprocessing
itsmanjeet
Hey all,
Is it safe / ok to do,
std::any x = std::make_unique or shared_ptr
As google and c++ docs said that std::any also alloc same memory on heap
Anonymous
anyone please help me
klimi
Anonymous
in c language. what search program is suitable for managing student data consisting of student id, assignment scores, test scores, and course graduation status (passed or not). one of the features in this program is to search for student data based on student id
UrCodeBuddy️ 💻
I just shifted from Python to C++, am learning it now. I have read and like i can understand codes, but i wasnt some fairly simple problems, like projects that makes me practice. Can any of u suggest me some small ideas ?
UrCodeBuddy️ 💻
thanks in advance
Anonymous
I have just one doubt
Anonymous
Is Cohen-Sutherland Algorithm still used anywhere
nadiaanissa
Hello hi, do you guys have any idea how to count a parking fee for more than 24hour with different rate in C++ language.
(Example questions;
First 2 hour = $2
Office hour (10:00 - 17:00) = $6
After Office hour (18:00 - 9:00) = $10)
BBB
Hi! I'm studying C and I'm stuck with this assignment. I have to print the last n characters of a string
https://github.com/B-3ia/C/commit/748f11141d3e1d615e5bef0e4251f5a894777c81
Hima
BBB
Prince Fine
How does this code print the word in the reverse mode 🤔
char *str = "Hello"
strange(str, 0);
void strange( char *str, int i)
{
if(i <strlen(str))
strange(str, i+1);
cout<<str[i];
}
Pavel
3 thing to notice:
- things before recursive call will be called first (try printing something before the if)
- recursion end condition (the if with strlen)
- things after recursive call (printing to cout in this case) will all be called after, when unwinding stack
hamza
Is there a framework or a library for C to use it in backend Web development
Vikash
#include <stdio.h>
int main()
{
char option;
int a,b;
printf("Enter two values:\n");
scanf("%d%d",&a,&b);
printf("Please Enter option like\nAddition for +\nSubtraction for -\nMultiply for *\nDivision for /\n");
scanf("%c",&option);
switch(option)
{
case'+': printf("Addition is %d\n",a+b);
break;
case'-': printf("Subtraction is %d\n",a-b);
break;
case'*': printf("Multiply is %d\n",a*b);
break;
case'/': printf("Division is %d\n",a/b);
break;
default: printf("invalid choice\n");
}
return 0;
}
Vikash
Rodrigo
#include <stdio.h>
int main()
{
char option;
int a,b;
printf("Enter two values:\n");
scanf("%d%d",&a,&b);
printf("Please Enter option like\nAddition for +\nSubtraction for -\nMultiply for *\nDivision for /\n");
scanf("%c",&option);
switch(option)
{
case'+': printf("Addition is %d\n",a+b);
break;
case'-': printf("Subtraction is %d\n",a-b);
break;
case'*': printf("Multiply is %d\n",a*b);
break;
case'/': printf("Division is %d\n",a/b);
break;
default: printf("invalid choice\n");
}
return 0;
}
Hey man, you need to clean the buffer before asking the user for a 'char'
Try %d %d %*c in the first scanf
By doing this, you are cleaning the input buffer
Vikash
hamza
klimi
Uhh anyone
Um ofc there is... Idk much about it but I think you could even use CGI for it
Prince Fine
Prince Fine
Hima
Anonymous
Anonymous
comparing a float with double, what else do you expect ?
#include <stdio.h>
int main(void) {
float upperLimit = 0.00300;
for(float lowerLimit = 0.00100; lowerLimit <= upperLimit; lowerLimit += 0.00025){
printf("%f ", lowerLimit);
}
printf("\n");
upperLimit = 0.00200;
for(float lowerLimit = 0.00100; lowerLimit <= upperLimit; lowerLimit += 0.00025){
printf("%f ", lowerLimit);
}
return 0;
}
for example for this code both upperLimit and lowerLimit are float...
but when upperLimit is odd then for last value it is evaluating to false [i.e for 0.00300 <= 0.00300 is false]
but when upperLimit is even then for last value it is evaluating to true [i.e for 0.00200 <= 0.00200 is false]
why this kind of behaviour...?
Anonymous
Hima
Anonymous
If I'm doing something wrong then pls tell me what us correct way to compare floating numbers...?
Anonymous
Anonymous
Anonymous
Even I changed the data type to double then it's wrong output for when upper Limit is even...
Anonymous
Yeah it's working...
Thank you very much for putting your time to understand my problem...
If u can pls tell me why it was not working or share any article related to this problem then it would be very helpful...
Hima
tkali
Hey guys how can I write this in program 7√(𝑥^y)/ cos−1(0.7)
SAHIL
Hello
SAHIL
Please someone DM me a cpp book
SAHIL
SAHIL
🥺
Dima
read the rules
SAHIL
Check for ASCII value
Aman
#include<iostream>
#include <cmath>
using namespace std;
bool isPerfectSquare(int n)
{
int sr = sqrt(n);
if (sr * sr == n)
return true;
else
return false;
}
int multiply(int array[], int s,int e)
{
int pro = 1;
for (int i = s; i < e; i++)
pro = pro * array[i];
return pro;
}
int main()
{
int t,n,p;
cin>>t;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
p=0;
for(int i = 0;i<n;i++){
for(int j=i+1;j<n;j++){
if(isPerfectSquare(arr[i]*arr[j])){
p++;
}
else{
continue;
}
}
}
for(int i =0;i<n;i++){
for(int j=0;j<n;j++){
if(isPerfectSquare(multiply(arr,i,j))&& i<=j){
p++;
}
else{
continue;
}
}
}
cout<<p;
return 0;
}#include <iostream>
#include <cmath>
using namespace std;
bool isPerfectSquare(int n)
{
int sr = sqrt(n);
if (sr * sr == n)
return true;
else
return false;
}
int multiply(int array[], int s,int e)
{
int pro = 1;
for (int i = s; i < e; i++)
pro = pro * array[i];
return pro;
}
int main()
{
int t,n,p;
cin>>t;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
p=0;
for(int i = 0;i<n;i++){
for(int j=i+1;j<n;j++){
if(isPerfectSquare(arr[i]*arr[j])){
p++;
}
else{
continue;
}
}
}
for(int i =0;i<n;i++){
for(int j=0;j<n;j++){
if(isPerfectSquare(multiply(arr,i,j))&& i<=j){
p++;
}
else{
continue;
}
}
}
cout<<p;
return 0;
}
The code is used to find the number of subsets in an array so that the product of elements is a perfect square.But this program has a bug that it counts 1 case extra and I'm not able to remove that bug pls help somebody
Hima
#include<iostream>
#include <cmath>
using namespace std;
bool isPerfectSquare(int n)
{
int sr = sqrt(n);
if (sr * sr == n)
return true;
else
return false;
}
int multiply(int array[], int s,int e)
{
int pro = 1;
for (int i = s; i < e; i++)
pro = pro * array[i];
return pro;
}
int main()
{
int t,n,p;
cin>>t;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
p=0;
for(int i = 0;i<n;i++){
for(int j=i+1;j<n;j++){
if(isPerfectSquare(arr[i]*arr[j])){
p++;
}
else{
continue;
}
}
}
for(int i =0;i<n;i++){
for(int j=0;j<n;j++){
if(isPerfectSquare(multiply(arr,i,j))&& i<=j){
p++;
}
else{
continue;
}
}
}
cout<<p;
return 0;
}#include <iostream>
#include <cmath>
using namespace std;
bool isPerfectSquare(int n)
{
int sr = sqrt(n);
if (sr * sr == n)
return true;
else
return false;
}
int multiply(int array[], int s,int e)
{
int pro = 1;
for (int i = s; i < e; i++)
pro = pro * array[i];
return pro;
}
int main()
{
int t,n,p;
cin>>t;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
p=0;
for(int i = 0;i<n;i++){
for(int j=i+1;j<n;j++){
if(isPerfectSquare(arr[i]*arr[j])){
p++;
}
else{
continue;
}
}
}
for(int i =0;i<n;i++){
for(int j=0;j<n;j++){
if(isPerfectSquare(multiply(arr,i,j))&& i<=j){
p++;
}
else{
continue;
}
}
}
cout<<p;
return 0;
}
The code is used to find the number of subsets in an array so that the product of elements is a perfect square.But this program has a bug that it counts 1 case extra and I'm not able to remove that bug pls help somebody
Read the rules. Use an online pasting service
Anonymous
What basics should I learn in c programming?
Anonymous
Hello, I'm doing a project but I'm having difficulty with the graphic.h library, I have to print a Cartesian plane and a line from the center to a point in the plane. The part of the axes is me, but I can't make the line from the origin to a point. I managed to start the straight line from the origin but I can't do the rest. I have the length of the line and the angle, with the formula l * cos (alpha) I calculated the point. (https://pastebin.com/E0gaEYr2)
Devjit
/getnotes
Aman
Aman
can anyone tell me how should i share my code snippet form an online pasting service to this channel pls
mito
Aman
thanks
Aman
#include <iostream>#include <cmath>using namespace std;bool isPerfectSquar - Pastebin.com
https://pastebin.com/Hdt2pshT
Salwa
Hi, im having a problem in my project, the project ask me to do a bill for person who stay at hospital, i need to calculate their room bill, and food bill and others bill. I use loop since i need to make as many as bill. At the end, i need to sum only the room bill for all people that stay at the hospital. Can you suggest what i need to do for calculate all the room bill only.
Anonymous
Mario
/get cppbookguide
Salwa
just add them
But the user will input the number. So how can i add them
Anonymous
yeah
Aman
Aman
Pavel
Pavel
Is it the part of the task?