[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 x; int n; double sum; double sum2; public: Statistics(double _x, int _n); void Accumulate(double data);// ~Statistics(); double mean()const; double sigma()const; void Print() const; }; int main(){ double data; double sum=0.0,sum2=0.0; int n=300; ifstream in("file.txt"); for(int i=0; i <= n ; i++){ in >> data; sum+=data; sum2+=data*data; } in.close(); Statistics a(data, …

Member Avatar
Member Avatar
+0 forum 3

Hi I having trouble to export DLL which would contain one fucntion. The function would create an MFC dialog object, then the object is instantiated and then run method is invoked. The user input from the dialog would be the return value to the function and also it would the return value from the DLL function. The difficulty is that I am trying to export C dll not C++ DLL and the porgramming tool I am using is not configurable for any dependancies. Is my task achievable? If achievable then I will have to post my code perhaps I have …

Member Avatar
Member Avatar
+0 forum 1

Hi I am considering to use C++/CLI because of .NET. My aim is to create DLLs where these would be used by some language. Would I be getting any problems if I decided to export DLL containing managed code? Any portability issues? Thanks in advance

Member Avatar
Member Avatar
+0 forum 1

Hi I am developing using C/C++ window application using winapi. I will be using some standard STL containers and some win api functions provided by windows.h. I would like use the app on different windows versions such as windows 7 and 10. The apps will be builded for x86 architecture. Would I be getting any issues if app are run on x64? The apps wont need any permissions to access restricted folders. At the moment I am not getting any issues running on windows 7. I am just thinking about common possible pitfalls.

Member Avatar
Member Avatar
+0 forum 4

The program needs to get loan amount, loan term, and loan interest rate from the user and then use those same numbers to create a function that calculates the monthly payment of the loan using monthlyPayment = principal * rate / ( 1.0 – pow(rate + 1, -term)); I've come this far. After I get the amounts from the user, how do I use what they inputed to save in the program so I can use those same answers in the monthlyPayment function for the calculation? Any help is greatly appreciated! #include <iostream> #include <string> #include <cmath> using namespace std; …

Member Avatar
+0 forum 0

Hey everyone of the c++ world. I am a little stuck. Here is what i am suppose to be doing. Write the program as an object-oriented C++ program that calculates and displays the mortgage payment amount from user input of the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage. Allow the user to loop back and enter new data or quit. Insert comments in the program to document the program. Now, with this here are the instructions from the instructor: "The following instructions tell you how I want your programs submitted for …

Member Avatar
Member Avatar
+0 forum 10

I'm trying to add insert functionality to a textbook code example. I have an "off by one" error and I can't think of a way to fix it. Here's my attempt below: template< class NODETYPE > void List< NODETYPE >::insertMiddle( const NODETYPE &value, int position ) { ListNode< NODETYPE > *newPtr = getNewNode( value ); ListNode< NODETYPE > *curr = firstPtr; ListNode< NODETYPE > *curr2 = firstPtr; if ( isEmpty() ) firstPtr = lastPtr = newPtr; else { if (position == 1) insertAtFront( value ); cout << "curr->data is: "<<curr->data<<endl; for (int i = 1; i != position; ++i) curr …

Member Avatar
Member Avatar
+0 forum 3

I should go to this program mentioned below. make a double loop (do ... while) to suppress an incorrect daily calculation!note :::: work with a char variable "error" for erroneous daily calculation. In contrast to the origin program, deposit and payout data should be requested again for a result of the daily bill of 0 or a number in the minus area! #include <iostream.h> #include <conio.h> #include <stdio.h> main () { char error = "n"; int e_tag, e_mon, e_jahr, a_tag, a_mon, a_jahr, days; float capital, interest rate, interest rates; do { error = "n"; cout << " <snip> cin >> …

Member Avatar
Member Avatar
-1 forum 1

So, I have created a text file containing the following: 10001 General Electronics 500 20001 fACEBOOK 700 10002 Twitter 400 The records are stored in a struct containing an integer id, string company and integer number of shares variables. I want the user to enter a Id, say 20001, and the output should display the details of only that particular user and not of anyone else. Also, I want to change number of shares of user 20001 from 700 to 600.

Member Avatar
+0 forum 0

I am updating a C++ program, part of which copies arrays of doubles by iterating through each array (copies elements of array wa2 into array X): for (j = 0; j < N; ++j) { X[j] = wa2[j]; } // End for j I would like to use the built-in function copy, so am going through the program replacing all loops with copy: copy(wa2, wa2 + N, X); However, this causes my compiler to complain: > error C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values …

Member Avatar
Member Avatar
+0 forum 3

the question seems simple, but isn't. think that i have the functions list and it's parameters and the variables on vectors(inclued it's types.. it's a structure). now see these string(yes i have the words\operators count): function1 ( function2 ( ) , function3 ( parameter1 ) , parameter3 ) the count, in these sample, is 13. like you see i have a function, these function have parameters... these parameteres have functions and variables.. that functions can be another functions(nested functions). these sample is like a nested functions call. my question is: how can i create a nested loop for control all …

Member Avatar
Member Avatar
+0 forum 9

i want to write code in data structure using c++. my topic is online voting system.

Member Avatar
Member Avatar
+0 forum 3

Hello! I am interested in the issue of protecting the code from hacking. Do you protect your code from decompiling and hacking? Why did the question arise? I worked in a team that developed games for Android. They all used obfuscators! So almost no one could hack their application. Now I am interested in the topic of code protection. I looked at the existing topics, they are slightly outdated (8-10 years ago were relevant). Use / not use obfuscator? Which to choose?

Member Avatar
Member Avatar
+1 forum 15

I am working on a equation balancer for my 12th class computer science project.But somehow i am not able to balance the chemical equation.Please if anyone can provide me the source code it will be a great help.Urgently needed!

Member Avatar
Member Avatar
+0 forum 14

i create the read(...) function for read to variables. but i need too the read()(without arguments) for press enter before continue\exit. void read() { //wait if the enter key is pressed: cin.ignore(); cin.get(); } template<typename first_t, typename... rest_t> void read(first_t &first, rest_t... rest) { std::cin >> first; read(rest...); //function is recursive //when the parameter pack becomes empty //read(); will be called with no parameters //which is why we declare it above } void read(string &parameter) { std::getline (std::cin,parameter); } void read(char *parameter) { cin.getline (parameter, 256); } read(); the problem is that i need press, 2 times, the enter for …

Member Avatar
Member Avatar
+0 forum 11

i'm trying using the GNU compiler with command lines( using the ShellExecuteEx()). when i do: string FileName1="C:\\Program Files\\mingw-w64\\x86_64-7.2.0-win32-seh-rt_v5-rev1\\mingw64\\bin\\x86_64-w64-mingw32-g++.exe"; run(FileName1,"-c \"C:\\Users\\Cambalinho\\Documents\\CB\\testfolder\\bin\\Debug\\test2.cpp\""); the object file is created. these line creates the exe: run(FileName1,"-o C:\\Users\\Cambalinho\\Documents\\CB\\testfolder\\bin\\Debug\\test2.exe C:\\Users\\Cambalinho\\Documents\\CB\\testfolder\\bin\\Debug\\test2.o"); (tested) but the exe have some dependencies... so seen the Code Blocks: x86_64-w64-mingw32-g++.exe -Wall -g -std=c++14 -c C:\Users\Cambalinho\Documents\CB\testfolder\main.cpp -o obj\Debug\main.o x86_64-w64-mingw32-g++.exe -L"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86" -o bin\Debug\testfolder.exe obj\Debug\main.o -static-libstdc++ -static-libgcc -fpermissive "..\..\..\..\..\Program Files\mingw-w64\x86_64-7.2.0-win32-seh-rt_v5-rev1\mingw64\x86_64-w64-mingw32\lib\libgdi32.a" Output file is bin\Debug\testfolder.exe with size 2.92 MB Process terminated with status 0 (0 minute(s), 8 second(s)) 0 error(s), 0 warning(s) (0 minute(s), 8 second(s)) the "-static-libstdc++ -static-libgcc" adds the exe …

Member Avatar
Member Avatar
+0 forum 7

Hi all, I'm having a little problem with array and some "unqualified-id" problem. I've created gazillions (okay, maybe 80) arrays before but I had never encountered such problem. Especially with static arrays. [CODE] #include <stdio.h> #include <cstdlib> using namespace std; int main() { // with addition of buffers for 3x3 square mask // 8x8 original image is now 10x10 int [][] imageSquare = //12 { {4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, {4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, {4, 4, 4, 4,48, 4, 4, 4, 4, 4}, {4, 4, 4,64,64,64,64, 4, 4, 4}, …

Member Avatar
Member Avatar
+0 forum 10

Create a text file (w/o using any C++ program) containing the names of students and their marks in the following format: **Ajay 350 Vijay 340** where name and marks are separated by either a space or a tab and end of line is a record separator. Write a program to read this file and display the records in two columns name and marks. Within the name column, the students’ names are to be left justified and marks are to be right justified in the marks column.

Member Avatar
Member Avatar
-2 forum 2

hi so i am studying programming and i want to extract from an inputted string values in the left right and middle. i have only begun learning a few months ago so i dont know anything about pointer how to i build a funtion to extract the mid left and right of string. For instance the input was 25+63=11 i want to extract the first number the opperand the second number and the answere so a=25 b=+ c=63 d=11 so that i can add/sub/multiply/divide the first two numbers and check if the answere in the string is correct. thank you.

Member Avatar
Member Avatar
+0 forum 1

and im working on Archery, bow hunting, bow sling, paracord, backcountry gear, tree stand, my sling-a-ling ,jakt gear, total archery challenge, hunting accessories, bowhunting accessories, bowhunting gear, bow hunting, 3D archery, archery tournaments, hunting season, archery sling, archery accessories much more .Im new in this forum I need lots of help and information Thank u.

Member Avatar
Member Avatar
+0 forum 2

hello. how can i print out in textbox a void * value ? here is the code: uintptr_t offsetFromBuffer = (uintptr_t)internalAddress - (uintptr_t)&buffer; void * healthDecAddress = (void*)(currentChunk + offsetFromBuffer); richTextBox1->Text = healthDecAddress; // how can i do it right ?

Member Avatar
Member Avatar
+0 forum 3

Ok so I have been trying to do project euler problem 1 which finding the sum of all the multiples of 3 and 5 that are less than a thousand. i dont know why my program is not working. here's my program - [code=c++] #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { int multiplier3 = 1; // multiplier of 3 int multiplier5 = 1;//multiplier of 5 int mult3 = 0; // multiple of 3 int ans3 = 0; // sum of multiples of 3 int mult5 = 0;//multiple of 5 int ans5 = 0;// sum …

Member Avatar
Member Avatar
+0 forum 2

Hello, friends. I did the fourth challenge on Project Euler and I'd like to know what I can do to improve the efficiency of my code. Right now it takes 1.562s to run and the source code is as follows: #include <iostream> #include <string.h> using namespace std; int Number = 0; int Reversed_Number = 0; int First_Number = 0; int Second_Number = 0; int Product = 0; int Biggest_Palindrome = 0; bool Is_Palindrome = false; string Text_Valued_Number = ""; string Text_Valued_Reversed_Number = ""; void Reverse_Number (int); void For_Loop (int,int); void Check_if_Number_is_a_Palindrome(int,int); void Show_Number(int); void For_Loop(int First_Number, int Second_Number) { for …

Member Avatar
Member Avatar
+0 forum 5

What are general considerations when choosing an open source library

Member Avatar
Member Avatar
+0 forum 1

#include <iostream> #include <cstdlib> #include <fstream> #include <ctime> using namespace std; void array(int arr[], int arrSize); void add(int arr[], int arrSize, int newElem); bool edit(int arr[], int arrSize, int index, int newVal); bool delEm(int arr[], int arrSize, int elem); bool search(int arr[], int arrSize, int elem); bool PunoNa(int arr[], int arrSize); void display(int arr[], int arrSize); void dispPo(int arr[], int arrSize, int index); void shuffle(int arr[], int arrSize); void loc(int arr[], int arrSize,int elem); int main(){ int choice = 0; int arrSize; cout<<"Enter size of array: "; cin>>arrSize; int arr[arrSize]; if(arrSize<=20){ for(int x=0; x<arrSize; x++){ cout<<"Enter elem"<<x+1<<": "; cin>>arr[x]; } …

Member Avatar
Member Avatar
+0 forum 2

heres my actual code for find\search a folder: string FindDirectory(std::string FindDirectoryName[2], std::string StartDirectory="C:") { WIN32_FIND_DATA file={0}; string str=StartDirectory+ "\\*"; HANDLE search_handle = FindFirstFile(str.c_str(), &file); static bool blnFindDirectoryName=false; static string strFolderName =""; //testing if the folder is valid: if (search_handle != INVALID_HANDLE_VALUE) { do { //if the folder was founded, then break the loop: if(strFolderName!="") break; //for avoid files names and the folders "." and "..": if ((file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && strcmp(file.cFileName, "..") && strcmp(file.cFileName, ".")) { //cout <<StartDirectory + "\\" + file.cFileName << endl; //testing if the folder was found //and add it on static strFolderName if(string(file.cFileName)==FindDirectoryName[0] && blnFindDirectoryName==false) { …

Member Avatar
Member Avatar
+1 forum 4

Hi, I have a C++ program : // ConsoleApplication14.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <list> #include <queue> #include <vector> #include <string> using namespace std; class RectangularVectors { public: static std::vector<std::vector<int>> ReturnRectangularIntVector(int size1, int size2) { std::vector<std::vector<int>> newVector(size1); for (int vector1 = 0; vector1 < size1; vector1++) { newVector[vector1] = std::vector<int>(size2); } return newVector; } static std::vector<std::vector<bool>> ReturnRectangularBoolVector(int size1, int size2) { std::vector<std::vector<bool>> newVector(size1); for (int vector1 = 0; vector1 < size1; vector1++) { newVector[vector1] = std::vector<bool>(size2); } return newVector; } }; class Cell { public: int x; int y; int …

Member Avatar
Member Avatar
+0 forum 2

Hi I am trying to get windows positioned in specific order as show below ![desired.PNG](/attachments/large/3/6447240b1491d04046fa904f31659f9b.PNG) but I am unable to get and get always this ![wrong.PNG](/attachments/large/3/71f4b92c4f40a6afeeab7e3c2f136526.PNG) the code below is shown HDWP cmdWnds; cmdWnds = BeginDeferWindowPos(col.size()); for (int i = 0; i < col.size(); i++) { if (i == 0) { if (DeferWindowPos(cmdWnds, col[i], HWND_NOTOPMOST, x_pos_start_pr + i * x_offset_pr, y_pos_start_pr + i * y_offset_pr, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW) == NULL) return ERROR; } else { if (DeferWindowPos(cmdWnds, col[i], col[i - 1], x_pos_start_pr + i * x_offset_pr, y_pos_start_pr + i * y_offset_pr, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW) == NULL) …

Member Avatar
+0 forum 0

I know an AVL Tree guarantees a time of log(n), but what is the time cost of the actual re balancing of the tree and why is this ignored?

Member Avatar
Member Avatar
+0 forum 2

I am a beginner in C++ coding. Now I am making a little text based game and i need to do a loading screen. I've kind of made one but i want to fill it with this shape ■. What i know is that the ascii code for it is "\u25A0". The code looks like that. #include <iostream> using namespace std; int main () { cout << " LOADING", _sleep(300), cout << " .", _sleep(300), cout << " .", _sleep(300), cout << " ." << endl; cout << " ["; for (int a = 1; a<30; a++) { _sleep(200); cout …

Member Avatar
Member Avatar
+0 forum 1

The End.