- Strength to Increase Rep
- +11
- Strength to Decrease Rep
- -2
- Upvotes Received
- 171
- Posts with Upvotes
- 145
- Upvoting Members
- 100
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
[CODE] //I need to make a class that calculate the mean and standard deviation. I have to test my program with an external file containing about 300 data. My program doesnt return the correct valuesAny help? #include <cstdlib> #include <iostream> #include <cmath> #include <fstream> using namespace std; class Statistics{ double … |
|
Write the C program that solve the quadratic equation problem The output should appear as follows: Enter A: 3 Enter B: 5 Enter C: 2 There are two solutions: -0.666667 and -1. Press any key to continue_ thank you, |
|
Ok I need to make a 3 part program thats made with c++. The first part is to write 10 number, and then program ask to ether repeat the number or to reapeat them reverse. Second part I need to make a program that ask for a word and later … |
|
So... I've slept since college - meaning I've forgotten a few things. I need to do an inner-join on two large-ish sorted vectors. Thought about converting them to unsorted sets and walking through "find-ing", but I'm pretty sure this is the fastest way to do it - and still accurately. … |
|
Hello, So I am first year at Uni and I am new to C++ and I am still trying to learn the basics. I can't seem to find the right way to start my exercise. Ex1. Create a program, which is with a main() function and menu-function for: 1.1) Inputting … |
|
In below code snippet , I am trying to add the intefeger and float values in Array template but was surprised to see below output for float value as 5.1 was expected there but getting 0 . Can anybody let me know what can be wrong here. output value=5 value=15 … |
|
Can someone help me please find the ploblem with this program ? I know it's a question of a misssing pointer but i don't know where to put it .. #include<stdio.h> void remplissage_matrix(char M[50][50],int l , int c); void remplissage_elements(int l, int c ,char M[50][50],char elements[100],int *n); void remplissage_histo(int histo[100],char … |
|
I have got a small problem with this program. It takes a user's input of numbers and sorts them by merge sort in increasing order using linked lists. Unfortunately, a segmentation fault appears immediately after I input the numbers. Probably something to do with the merge sort function. Help! [code] … |
|
Hi All, Below is the code of implementation of aggregation in c++. In this code class bar object will be contained in class a but class a won't act as a owner of class bar and due to this bar object is deleted after class a's life time ends. Now … |
|
How can we insert two independent random number to two equations (x,y) contain two parts like this: x = a* randomnumber1 + b* randomnumber2 y = c* randomnumber1 + d* randomnumber2 these two random number should be independent. Thank inadvance. |
|
[CODE=C++] #ifndef LIST_H #define LIST_H #include <iostream> typedef char Item; class List{ public: List() {first = NULL; last = NULL;} //~List() void append(Item entry); void remove_last(); void output(); private: struct Node { Item data; Node *next; Node *back; }; Node *first; Node *last; }; #endif [/CODE] I'm writing a class … |
|
|
|
I am trying to calculate the angle between two vectors. Here is my relevant code: cout << "\n\nPoint1 "; Point1.dump(); cout << "Point2 "; Point2.dump(); cout << "\nanswer: " << Point1.dot(Point2) << endl; cout << "\nacos: " << acos(-1)<< endl; cout << "Problem: " << acos(Point1.dot(Point2)) << endl; cout << … |
|
Q 1) In this small snippet #include <stdio.h> void passingAddressOfConstants(const int* num1 , int* num2) { *num1 = num2; } int main(){ const int limit = 100; int result = 5; passingAddressOfConstants(&limit,&limit); } Error : error: invalid conversion from 'const int*' to 'int*' Here I defined "limit" is of type … |
|
Hello I am tring to write a code to generate random numbers into an array, I don't understand why this isn't working. please help #include <iostream> #include <ctime> #include <cstdlib> const int NRows = 5; const int Ncols = 5; using namespace std; int main() { //declare variables int num[NRows][Ncols]; … |
|
# What's the problem in output where the algorithm was correct ???? # #include<iostream> #include<stdio.h> using namespace std; main() { int LA[100],K=1,N=5,L;//K=POSITION...N=element for(int i=0;i<=4;i++) { cin>>LA[i]; } L=LA[K]; for(int J=K ; J<N-1; J++) { LA[J]=LA[J+1]; } cout<<"DELETE ITEM:"; N=N-1; for(int P=0;P<=4;P++) { cout<<" "<<LA[P]; } } |
|
see my property constructor: template <typename T> class property { private: T PropertyValue; std::function<T(void)> getf; std::function<void(T)> setf; public: property(const T &value) { getf=nullptr; setf=nullptr; PropertyValue=value; } property(const property &value) : PropertyValue(value.PropertyValue) , getf(value.getf) { } property(std::function<T(void)> GetFunction=nullptr,std::function<void(T)> SetFunction=nullptr) { setf=SetFunction; getf=GetFunction; } inside a class i have 2 functions: void … |
|
Hey, guys. A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a² + b² = c². For example, 3² + 4² = 9 + 16 = 25 = 5². There exists exactly one Pythagorean triplet for which a + b + c … |
|
Hello. I need help with my assignment urgently. This is my assignment question and the follwoing is my code. It compiles but it doesnt give me the right output. 1. Run length encoding. Example: if the input is “AAABBCCCDEEFFA” the output will be “A3B2C3DE2F2A” 1. Input takes the form of … |
|
This is a homework problem; however I just want some direction. I have to write a module graph.cpp that implements djikstra's algorithm. so far i am at the reading in module and am trying to make an array of structures. here is the code. [code=c] // Zachary Dain // CSCI … |
|
heres my image class: class image { private: ULONG_PTR m_gdiplusToken; Gdiplus::GdiplusStartupInput gdiplusStartupInput; HDC hdcimage=CreateCompatibleDC(NULL); HGDIOBJ obj=NULL; HBITMAP btBitmap=NULL; Image *img; bool isimgused=false; int imageheight=0; int imageweight=0; int framecount=0; int intSelectFrame=0; int framedelay=0; string strfilename=""; Gdiplus::Color clrBackColor=Gdiplus::Color::Transparent; HDC hdcwindow; bool blnTransparent=true; HICON HICONFromHBITMAP(HBITMAP bitmap) { BITMAP bmp; GetObject(bitmap, sizeof(BITMAP), &bmp); HBITMAP … |
|
Hi, how can i avoid of key beeing inserted into wrong location.If i do lets say 3 numbers ,5 digits long like 12345,23445,56745 and choose location 45,they will be inserted to location 45,but if try to insert 67452 to the same location it will be inserted,but i need it to … |
|
Not working right, else is getting error. #include <iostream> #include <iomanip> #include <cmath> #include <string> using namespace std; int main() { // Declare variables below here int CORRECT, WRONG; double a, b, correct, result; char choice, answer; cout <<"Let's practice addition or subtraction with random integer numbers <100"<<endl; cout <<"---------------Math … |
|
Hi I am wondering how you would create a program for the knight tour instead of using recursion using a stack. I just want the ideal behind using a stack/queue instead of recursion please no code:) |
|
So here is my WORKING code. My problem lies in the output when I enter "0" or "00" for the hour in 12 midnight. No matter what it still outputs a 0 for midnight. (I want it to convert it to standard time.) I know it is something easy that … |
|
So far I have this but I need to use switch statements to make age< certain numbers for each age group. #include <iostream> #include <iomanip> #include <string> using namespace std; const float CHILDREN_MALE=50.00; const float CHILDREN_FEMALE=55.00; const float TEENAGERS_MALE=150.00; const float TEENAGERS_FEMALE=155.00; const float ADULTS_MALE=275.00; const float ADULTS_FEMALE=250.00; int main() … |
|
I'm trying to write 2 dimensional array of int type to a binary type file. int array[3][3]={Some data}; ofstream f; f.open("nameoffile.dat",ios::binary||ios::out); for(i=0;i<=3;i++) { for(j=0;j<=3;j++) { f.write((char *)&array[i][j],sizeof(array)); } } f.close(); Above code is not complete. I only wrote a part of the code where I need help. Is this code … |
|
Hi, I'm new here :) the problem is if i increment one member, for eg --------------------------------------- struct day { int hour[40]; int min[40]; int mins[40]; int rec; int totmins; int totsal; char status; int temp; }; struct month { struct day *da;}; struct year { struct month *mn;}; struct roll … |
|
#include <iostream> using namespace std; double polynome3(double a0,double a1,double a2, double a3) ` double y[21]; double z[21]; for (int k=0;k<21;k++) { y[0]=1; y[1]=1; y[2]=1; /* Bernoulli's algorithm */ y[k+3]=-(((a1*y[k+2])+(a2*y[k+1])+(a3*y[k]))/a0); // cout<<y[10]/y[9]<<endl; } double alpha1=y[20]/y[19]; cout<< "The first solution is alpha1 = " << alpha1<<endl; double b0=a0; double b1=a1+alpha1*b0; double b2=-(a3/alpha1); … |