Hello,
a friend of mine asked me to make this program for his university, the thing is i only know c# and have no idea about c++, his deadline is tomorrow and he have no idea what to do. so i thought i can ask for help here !
write a program that takes N grades from keyboard (float) & N, & perform the following calculations:
-avg,max,min,sorting
-standard diviation & variation
this should use function for each task including input values and olp results.
We're not going to do someone else's complete homework assignment for them. Someone can help or give hints, but the person whose homework it is needs to put forth their own effort :)
i totally get where are you coming from, but this person is very dear to me, and he had a very unfortunate circumstances that stopped him from studying for month, he never failed me once and i am not planning to fail him, if i have i will learn the language now if someone can point me into the right things i need to complete the assignment, and it's not a long assignment so i will really, really REALLY thankful if someone can help me, i can write it in quick basic and someone can translate it (i don't have c# ATM).
sorry, i totally understand that's it's really not a good move to be asking people to do a complete assignment, and i never seen my self in this position, but this time i really need help.
thanks.
can anybody atleast tell me how many lines it would take to code it ?
thanks !
Thanks, i don't have c# installed right now so i did it with Qbasic.
input "enter number of variables";N
for i = 1 to n
input z if z > max then max = z
if z < min then min = z
avg = avg +z
next i
print max,min,avg
sorry but i didn't know what standard diviation & variation exactly means, and also the i had a problem doing the sorting.
thanks for your helpin, and please tell me how many lines it will be.
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using std::cout;
using std::cin;
using std::vector;
using std::endl;
using std::sort;
int main(){
vector<double> notes;
cout<<"Enter some notes and hit ctrl+D followed by an <enter> to stop: ";
double input;
while(cin >> input){
notes.push_back(input);
}
cout<<endl<<"Entered notes: ";
for(int i=0; i<notes.size(); ++i){
cout<<notes[i]<<" ";
}
sort(notes.begin(), notes.end());
cout<<endl<<"Min: "<<notes[0]<<" Max: "<<notes[notes.size()-1];
}
Do some research on the other topics and implement it on top of the above code(ie how to calculate the standart deviation)
You'll need to know how to calculate those things on paper before you can code it.
thanks alot for your help, i just downloaded Blocks so i now have a compiler, and i ran your program and it's running great (thanks again),
how can i replace the ctrl + d with an input to determined how many inputs gonna be (loop), and how can i put the avg and sorting in there please ?
thanks !
weird....
i copied the SAME code to my block compiler and still getting wrong results :/
i think i'll go back to the online compiler !
sorry if i'm being spoon fed, but i am trying to put the sorting in-there (from min to max) and getting rid of the ctrl + D and replacing it with input:
example in QBasic
input n
for i = 1 to n
'do things
next i
how can i translate it to C++ and add the sort, i only need those and i am done.
thanks alot, and i am VERY sorry for taking so much of your time !
EDIT :
i found this code for sorting , can't get it in there without messing up everything.
int partition(apvector <int> &array, int top, int bottom)
{
int x = array[top];
int i = top - 1;
int j = bottom + 1;
int temp;
do
{
do
{
j - -;
}while (x >array[j]);
do
{
i++;
} while (x <array[i]);
if (i < j)
{
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}while (i < j);
return j; // returns middle subscript
}