olli
Yes, I mean some 3rd party libraries
The only implementation I can think of right now is llvm's SmallVector, but I don't think it can be easily used outside of LLVM.
https://llvm.org/doxygen/SmallVector_8h_source.html
Aakash
Who's here dot net developer
Hanz
Earl B
I am trying to write a program that divides an input into the smallest denomination of bills (50, 20, 10, 5, 1), and I have it mostly working great but for some reason it stops after displaying the amount of 5's.
#include <stdio.h>
int main()
{
int input = 0, amount = 0, remainder = 0;
int bills[] = {50, 20, 10, 5, 1};
printf("Enter an amount of dollars\n");
scanf("%d", &input);
for(int i = 0; i < input; i++)
{
amount = input / bills[i];
remainder = input - (amount * bills[i]);
if (remainder > 0)
{
input = remainder;
}
printf("That is.. %d $%d\n", amount, bills[i]);
printf("%d\n", remainder);
}
return 0;
}
Output: Enter an amount of dollars
98
That is.. 1 $50
That is.. 2 $20
That is.. 0 $10
That is.. 1 $5
uncommenting the last printf statement shows that the remainder is 3 in the above example. I have tried changing the for statement to > 4, and adding an else. I am lost.
i've also tried changing the input to tons of different values, but it always stops before the last loop.
can anyone explain to me why it just stops at the 5's?
Anonymous
I am trying to write a program that divides an input into the smallest denomination of bills (50, 20, 10, 5, 1), and I have it mostly working great but for some reason it stops after displaying the amount of 5's.
#include <stdio.h>
int main()
{
int input = 0, amount = 0, remainder = 0;
int bills[] = {50, 20, 10, 5, 1};
printf("Enter an amount of dollars\n");
scanf("%d", &input);
for(int i = 0; i < input; i++)
{
amount = input / bills[i];
remainder = input - (amount * bills[i]);
if (remainder > 0)
{
input = remainder;
}
printf("That is.. %d $%d\n", amount, bills[i]);
printf("%d\n", remainder);
}
return 0;
}
Output: Enter an amount of dollars
98
That is.. 1 $50
That is.. 2 $20
That is.. 0 $10
That is.. 1 $5
uncommenting the last printf statement shows that the remainder is 3 in the above example. I have tried changing the for statement to > 4, and adding an else. I am lost.
i've also tried changing the input to tons of different values, but it always stops before the last loop.
can anyone explain to me why it just stops at the 5's?
print i and input at the end of the loop ...
Anonymous
hello
Anonymous
You are to use Visual Studio to write a simple desktop calculator that uses postfix notation. Postfix provides two operands and finally an operator. The following shows the typical input and output of a calculator like this:
30 5 +
35
This means that the program takes the numbers 30 and 5 and uses the operator + to add them and then prints the result.
You should write a program which will:
• Read 2 floating point numbers,
• Read an operator (+, -, *, /, %)
• Check for error conditions such as a missing or unknown operator, division by zero, modulus by zero or trying to do modulus on non-integral values
• Print either an error message or the result of the calculation and then terminate
• If the result of the calculation is an integer, it should be printed with no places after the decimal.
You should submit:
• A program calculator.c that runs on Visual Studio,
• A file reflect.txt that answers the reflections below
• Since Blackboard only allows one file to be attached, you can combine these into a single zip file for submission. Or , you can write your reflections (preffered) in the .c file at the bottom after your code.
Reflections
1. Describe the decision structure you used to perform the calculation for the different operators. Why did you pick this decision structure over the competing ones?
2. How did you determine if the numbers you read were integers or floating point? Describe your technique in detail.
Anonymous
how to do this one? thankyou
Anonymous
yes i try
Anonymous
not working
Anonymous
ok then usual way of asking online is to show your code and error .. if too long then use one of the online pasting services ... so someone who knows can help you
Anonymous
You are to use Visual Studio to write a simple desktop calculator that uses postfix notation. Postfix provides two operands and finally an operator. The following shows the typical input and output of a calculator like this:
30 5 +
35
This means that the program takes the numbers 30 and 5 and uses the operator + to add them and then prints the result.
You should write a program which will:
• Read 2 floating point numbers,
• Read an operator (+, -, *, /, %)
• Check for error conditions such as a missing or unknown operator, division by zero, modulus by zero or trying to do modulus on non-integral values
• Print either an error message or the result of the calculation and then terminate
• If the result of the calculation is an integer, it should be printed with no places after the decimal.
You should submit:
• A program calculator.c that runs on Visual Studio,
• A file reflect.txt that answers the reflections below
• Since Blackboard only allows one file to be attached, you can combine these into a single zip file for submission. Or , you can write your reflections (preffered) in the .c file at the bottom after your code.
Reflections
1. Describe the decision structure you used to perform the calculation for the different operators. Why did you pick this decision structure over the competing ones?
2. How did you determine if the numbers you read were integers or floating point? Describe your technique in detail.
how to do this one? please help me on this one ! its my midterm exam !
Anonymous
don't just give the problem and ask for help blindly
Anonymous
Anonymous
.... use freelancer sites .. not here
Anonymous
cheat also learn to cheat smartly :)
Anonymous
yes please send me a link on how to pay to them? to do the question
Anonymous
you are a student ... learn to use google and search what are the "freelance websites"
Anonymous
Is dot net C++ library?
Not really in complete sense! But .Net frame work supports C++ too. Its has common language run time. It supports almost all source codes
Ravi
Anonymous
What is efficiency of online free compilers and Free IDEs to compile STL Code? I am using vector and linked list in VS code and eclipse ide and its always showing some warnings
Ravi
Online compilers are efficient but we dont enjoy that much as our pc or laptop, try to resolve the warning,
Anonymous
Thank u
Anonymous
Anonymous
What's wrong? while( (i < 10) && (i > 24))
A. the logical operator && cannot be used in a test condition
B. the while loop is an exit-condition loop
C. the test condition is always true
D. the test condition is always false
Anonymous
Is it c , and why?
Neeraj
Anonymous
Anonymous
Why?
Why u think it will come true?
Neeraj
Why?
cauz When if i is less than 10 then it can never be greater than 24 and, The operator && means both condition should be true then only while loop will run.
Anonymous
U know a number that less than 10 and more than 24?
Anonymous
Anonymous
Neeraj
GHAMDAN_NSHWAN
Hii
Anonymous
Another question, what happened if we modify a const array?
Anonymous
Parameter*
Anonymous
It will be compiler error right?
Anonymous
Anonymous
artemetra 🇺🇦
i know about type casting, but what does this syntax mean:
(void*)0
saw it in a tutorial
Anonymous
Can anyone help me in c++ oop
Anonymous
Anonymous
Ravi
Code!
Sandeep
Sandeep
Anonymous
Okay ..what is Len = LPS[len-1] doing
It uses the preprocessed information in the array Lps to determine where the next search should begin. The LPS array stores information on the longest prefix suffix for each prefix string of the given input string. This is hard to explain over a chat. Search for KMP algorithm on Google. The wiki page has loads of info on it.
Anonymous
Hi guys i have taken an exam by hacker earth in C++. Even though i know fundemental programming i could not clear one single programming question due to time constraint! Is it possible fr people other than IT and Computer science to crack this exam?
Anonymous
Admin I'm teaching graphics designing free o can share my opinion here if you allow?
Anonymous
Yunus Emre
Can you help me about c++? Please immediately
™barynium†⋆。˚🇧🇷
I need a help here a c++ problem
Qn "Write a function which output all the prime numbers between 2 and a given positive integer 'n'."
Ravi
is Range of N given?
Anonymous
™barynium†⋆。˚🇧🇷
Ravi
Nop the question is it is
#include<iostream>
using namespace std;
bool isPrime(int n)
{
if(n==1) return false;
for(int i=2; i*i <= n; i++)
if(n%i==0) return false;
return true;
}
bool printPrime(int n)
{
for(int i=2; i<=n; i++)
{
if(isPrime(i)) cout<<i<<" ";
}
}
int main()
{
int n;
cin>>n;
printPrime(n);
return 0;
}
Apk
Ravi
Anonymous
#include <iostream>
#include <string>
#include <vector>
using namespace std;
 
int main()
{
    
    vector<string> myvector{ "This", "is",
                             "Geeksforgeeks" };
 
    // using begin() to print vector
    for (  it = myvector.begin();
         it != myvector.end(); ++it)
        cout << ' ' << *it;
    return 0;
}
Anonymous
This is sample code i am testing in VS code
Anonymous
where do you declared the it ?
Anonymous
°Moohaamed°
Anonymous
Anonymous
Diypa
HI
Diypa
Can function of type string return a value??? Like this ??? Thank you... string getText() {
string text;
cout <<"Enter Text.....";
getline (cin,text);
return text;
}
Anonymous
Diypa
HI, Billy. Yes, it did not work for me, so I think maybe I do it wrong...