Anonymous
Abod
Important Note: Write the explanations, pseudocode (algorithm) and flowcharts for all the questions using word processing software such as Microsoft word and then save them as a pdf document called StudentNumberExplainations.pdf Save every program separately, for example as Q1.c for question 1, Q2.c for question 2 , so on and so forth. Zip all the programs as a zip file called StudentNumberPrograms.zip. Upload the zip file and the pdf using the system portal. Solution to a question, without providing a flowchart, pseudocode as well as an explanation would not be considered for grading. Missing any of the vital components would result in getting a zero from that question: Vital components: 1. Well commented Program 2. Algorithm (pseudocode) 3. Explanation of the pseudocode 4. Flowchart 5. Explanation of the flowchart 6. General discussion on the program that explains why a certain technique was adopted
Q1) (Sales-Commission Calculator) One large chemical company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who sells $5000 worth of chemicals in a week receives $200 plus 9% of $5000, or a total of $650. Develop an algorithm, flowchart and program that will input each salespersons gross sales for last week and will calculate and display that salespersons earnings. Process one salesperson's figures at a time. Here is a sample input/output dialog: Enter sales in dollars (-1 to end): 5000.00 Salary is: $650.00 Enter sales in dollars (-1 to end): 1234.56 Salary is: $311.11 Enter sales in dollars (-1 to end): -1
Q2) (Pre-decrementing vs. Post-decrementing) Write an algorithm, flowchart and program that demonstrates the difference between pre-decrementing and post-decrementing using the decrement operator '--'.
Abod
Please i need help for these two questions
Anonymous
Important Note: Write the explanations, pseudocode (algorithm) and flowcharts for all the questions using word processing software such as Microsoft word and then save them as a pdf document called StudentNumberExplainations.pdf Save every program separately, for example as Q1.c for question 1, Q2.c for question 2 , so on and so forth. Zip all the programs as a zip file called StudentNumberPrograms.zip. Upload the zip file and the pdf using the system portal. Solution to a question, without providing a flowchart, pseudocode as well as an explanation would not be considered for grading. Missing any of the vital components would result in getting a zero from that question: Vital components: 1. Well commented Program 2. Algorithm (pseudocode) 3. Explanation of the pseudocode 4. Flowchart 5. Explanation of the flowchart 6. General discussion on the program that explains why a certain technique was adopted
Q1) (Sales-Commission Calculator) One large chemical company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who sells $5000 worth of chemicals in a week receives $200 plus 9% of $5000, or a total of $650. Develop an algorithm, flowchart and program that will input each salespersons gross sales for last week and will calculate and display that salespersons earnings. Process one salesperson's figures at a time. Here is a sample input/output dialog: Enter sales in dollars (-1 to end): 5000.00 Salary is: $650.00 Enter sales in dollars (-1 to end): 1234.56 Salary is: $311.11 Enter sales in dollars (-1 to end): -1
Q2) (Pre-decrementing vs. Post-decrementing) Write an algorithm, flowchart and program that demonstrates the difference between pre-decrementing and post-decrementing using the decrement operator '--'.
/warn assignment
ברני
ברני
Prince Of Persia
How to define lambda and how lambda work(in c++)
Prince Of Persia
Is lambda like a pointer to a function?
Anonymous
Anonymous
Prince Of Persia
No
Can you say how they work?
Anonymous
Pavel
Is lambda like a pointer to a function?
It's more like an object, but if you capture no data and don't do anything specific with lambda itself then it can be optimized to a function pointer.
Example how it can look like for the compiler: https://cppinsights.io/s/aa7da5a3
Prince Of Persia
Pavel
I mean not lambda but std::function type
Prince Of Persia
Pavel
Basically a wrapper for callable things (function pointers, lambdas)
JOKER
Just asking one question::
Why companies don't allow you to code in online rounds in python? It's either in cpp or Java.
Anonymous
Pavel
Oh what is that type?
You need it beacause you can't create array of lambdas directly, because lambdas have "magic" types (generated types, see my link above)
JOKER
I don't know where to ask this
Prince Of Persia
Anonymous
anyone has the OT group link
Dima
Shvmtz
printf("%c", '97');
printf("%d", '97');
Output:
7 97
Here, '97' is neither a character nor a string. What is it printing ?
Shvmtz
S
Anyone did u code a program in c program using all 32 keywords in ANSI C
Nameful
S
Just like that curious to see if its possible or not
Anonymous
Does anyone have Google Task Mate?
Nameful
S
Let's see
Георгий
I've read the rules and I agree with them
PaAaAria
hi, does anybody know newton-raphson method?, I have a problem with coding and I wonder if somebody could help me
Anonymous
PaAaAria
a very easy algorithm
yes, the algorithm is easy, but something is going wrong in my code and I don't understand why
Anonymous
and what is it
PaAaAria
I wrote a code which calculate the root of a parabolic function.
when I entered an initial guess which is very close to the root it calculates the root accurately. the point is that if I make a further initial guess it shows the wrong root. imagine that the root is 1.06 if I only enter 1 or 2 the root is calculated correctly but if I insert 20 the root is wrong although there is no other root except 1.06 in this area
PaAaAria
I don't know what the reason is
PaAaAria
and what is it
here is the code
https://hastebin.com/hemeyometi.cpp
PaAaAria
Igor🇺🇦
Parv
Hey , help me to learn C programing
Parv
I know , suggest me the best one
PaAaAria
PaAaAria
And I don't Know What the problem is
PaAaAria
As you can see if I insert 30, for instance, it gives me the wrong answer
PaAaAria
Although there is only one root between 1 and 30
Anonymous
Prince Of Persia
PaAaAria
Igor🇺🇦
Either I don't understand what your algorithm is trying to do or your condition should be the other way around while >, not while <
Igor🇺🇦
Anonymous
Igor🇺🇦
Anonymous
So u must make sure the beginning is not too far from thr root
PaAaAria
PaAaAria
PaAaAria
PaAaAria
For example for initial value 30 it gives me 15.27 as the root
PaAaAria
But if I use <= the answer is around 0.17
PaAaAria
You know the point is that
PaAaAria
Two conditions are checked Here to find the reasonable root. The if condition checks the function value of the d to understand whether it is small or not
And the while checks the substraction of dnew from the initial value and if it is also small the loop stops
Vitalii
#include <stdio.h>
#include <stdarg.h>
#define N 100
void MaxElem(int, ...);
int main()
{
MaxElem(34, 55, 89, 144, 0, 1, 1, 2, 233, 337, 90, -1);
return 0;
}
void MaxElem(int n, ...)
{
int arr[N] = {0};
int temp;
int j=0;
va_list (arg_list);
va_start(arg_list, n);
while((temp = va_arg(arg_list, int))>=0)
{
arr[j] = temp;
printf("\narr[j] = %d\n", arr[j]);
j++;
}
va_end (arg_list);
}
Why does my program skip number "34"? I just can't catch it((
Pavel
#include <stdio.h>
#include <stdarg.h>
#define N 100
void MaxElem(int, ...);
int main()
{
MaxElem(34, 55, 89, 144, 0, 1, 1, 2, 233, 337, 90, -1);
return 0;
}
void MaxElem(int n, ...)
{
int arr[N] = {0};
int temp;
int j=0;
va_list (arg_list);
va_start(arg_list, n);
while((temp = va_arg(arg_list, int))>=0)
{
arr[j] = temp;
printf("\narr[j] = %d\n", arr[j]);
j++;
}
va_end (arg_list);
}
Why does my program skip number "34"? I just can't catch it((
34 is passed as n, isn't it?
Vitalii
I'm sorry...for me that's new 😅
Pavel
Hm, or maybe not, can't find any examples
Vitalii
Oh, I just fount out that n works only with macros, so I can't use it in this way, only if I write amount of numbers...