48,986 Topics

Member Avatar for
Member Avatar for silvert122

Please could someone help me? my merge sort code is not sorting properly. this is the code: [CODE]#include <iostream> #include <string> using namespace std; void mergeArray(int a[],int sizeA, int b[],int sizeB,int result[],int *size); void display (int c[],int num); int main () { int a[]={45, 88, 12, 23, 65 }; int …

Member Avatar for tetron
0
129
Member Avatar for wilko1995

How do i make a code so that i can open a file if the person that is using it types 1 for yes or 2 for no Heres my code, [CODE]#include <iostream> #include <fstream> using namespace std; int main(){ // for logging in int Pass, Name; Pass = 159876; …

Member Avatar for Ancient Dragon
0
199
Member Avatar for CreativeCoding

I'm stuck with goto. I need to stop cause sometimes, it screws up my code. I used to do something like this. [CODE] int command; start: command = NULL; // this was a random guess to see if it would work cin >> command; if(command == 1){ cout << "Your …

Member Avatar for mrnutty
0
119
Member Avatar for ultrAslan

Hi, all I am trying to write a code for root test. I'm trying to do it recursively. For instance, If n = 25 and r = 2 then.. the domain is from 1 to 25 first it will add first number and last number which is 26 and divide …

Member Avatar for mrnutty
0
93
Member Avatar for XStrong

Here's my code: [CODE]#include <iostream> using namespace std; int Factorial(int n) { int total = 1; while(n!=0) { total = total * n; n--; } return total; } int Combinations(int n, int k) { int count = 1; for(int i=0; i<n; i++) { for(int y=0; y<(k-i); y++) { cout << …

Member Avatar for VernonDozier
0
126
Member Avatar for tarheelfan_08

Can someone please advise me as to why my assignment is not working? I am doing the exact same thing I did on another assignment and for some reason it wont work. Assignment 1. You are a programmer that works for a local bank. You are creating classes to be …

Member Avatar for thomas_naveen
0
199
Member Avatar for sid78669

I have been working on a template class for linked list and sometimes I come across this member function: [CODE=C++] template <class T> bool DLList<T>::deleteData(T data) { ListNode<T> *temp = head; while(temp != NULL && temp->data != data) temp = temp->next; if(temp == NULL) return false; else{ temp->previous->next = temp->next; …

Member Avatar for sid78669
0
91
Member Avatar for Andy_Ballard

Hello, I would like to import and call a c++ library from python. The library is the freely available (c++) LAMMPS Molecular dynamics code, and on the website, the following advice is given: "[one can]...build LAMMPS as a library. Once this is done, you can interface with LAMMPS either via …

Member Avatar for Andy_Ballard
0
3K
Member Avatar for dola91raw

I know that im not supposed to write like this but i just want to know how to sort 4 random chosen numbers (chosen by pc) in ascending order. Just the basic insert. Imstill abeginnerand cant use arrays!

Member Avatar for WaltP
0
65
Member Avatar for sid78669

I have the following classes, SLList, an integer datatype-based linked list and DLList, a template-based linked list. My problem is that SLList is working perfectly, but as soon as i modify it to be used as a template, i get errors, more specifically LNK 2019, i.e. linking errors. I avoided …

Member Avatar for sid78669
1
632
Member Avatar for sid78669

I am trying to compile a code that utilises an array of 5 'hotel' objects as below: [CODE=C++] #include "Hotel.h" using namespace std; int main() { Hotel *hotels = new Hotel[5]; hotels[0] = new Hotel("Hershey"); hotels[1] = new Hotel("Milton"); hotels[2] = new Hotel("Sheraton"); hotels[3] = new Hotel("BestWestern"); hotels[4] = new …

Member Avatar for sid78669
0
154
Member Avatar for silvert122

Hello guys, i am trying to write an insertion sort program with any values entered by any users but im getting some weird numbers. could someone help me see what s wrong with my code. this is my code: [code]#include <iostream> using namespace std; int main() { int a,b,c,d,e,f; int …

Member Avatar for silvert122
0
161
Member Avatar for Galf

Hi guys, I'm writing a simple function to return the file portion of a path. Strangely, the results I'm trying to duplicate accept something like a/b/c\d\e\file as a valid path, so I'm really just searching for the last occurrence of a slash or backslash. Anyhow, I'm curious what your thoughts …

Member Avatar for Galf
0
160
Member Avatar for Flow2

Hey I've been studying c++ for about a week and I do find myself with most codes to be a quick learner and I know pretty much all there is to cout so I decided to move on to the real stuff. But I wanted to use writeProcessMemory to edit …

Member Avatar for Fbody
0
87
Member Avatar for Christoph928

Need help with my code its not stopping once the correct answer is given i don't know why please help...I'm using 25 as the seed and the answer is 62 but my code says 62 is too high ... thank you.[CODE]#include <iostream> #include <cstdlib> using namespace std; int testTheGuess(int ,int); …

Member Avatar for Lerner
0
102
Member Avatar for xcarbonx

I'm making a program which outputs the min, max and average for any specified user input of numbers, for example a sample output would be: Enter a choice (0 for max, 1 for min, 2 for avg, 3 to quit): 1 How many numbers?: n numbers Enter n numbers: 1 …

Member Avatar for strmstn
0
108
Member Avatar for mbrinkley

Hello. I am an IT major at Arkansas Tech University. I just began programming this semester. I have been given an assignment to give a bank customer certain information about their account and charges. So here is a shortened version of the question: There are two types of accounts: Checking …

Member Avatar for mbrinkley
0
155
Member Avatar for matharoo

I am making a project of Railway reservation system. I want to input time of Train arrival and departure as hours and minutes. Now i want both of them to be entered in same line, first hours and then minutes but in same line i.e the cin should not go …

Member Avatar for WaltP
0
223
Member Avatar for er.chiraggupta

[code] std::ifstream in("chirag.txt"); char k[10]; in>>k; QString ch=QString(k); ui->mes->setText(ch); //mes is a Qlabel //ui is Qwindow object } [/code] /*Qlabel is showing nothing ... Please tell what is wrong with the above code */

0
53
Member Avatar for syue87

halo, im a newer in this c++ program.i try to execute this code(at the attachment) at ns2 unbuntu 9.10 but the following error occur. help me fix this error. analyze.cpp:55: error: ‘EXIT_FAILURE’ was not declared in this scope analyze.cpp:55: error: ‘exit’ was not declared in this scope analyze.cpp:61: error: ‘EXIT_FAILURE’ …

Member Avatar for WaltP
0
3K
Member Avatar for dinamit875

Hi everyone, I have written a program here about customers, it works fine so far, but I am having a problem with getting customer details, for example, when I enter customer name, age...etc, it saves this info into a customer.txt file, I can see this information until I exit the …

Member Avatar for WaltP
0
127
Member Avatar for chubkakes1

Hi, im fairly new to c++.I have a variable in my while loop that gets the x position of the mouse and constantly refreshes and outputs to the screen. My problem is that i want to get the exact x position wherever the mouse is when i press the 1 …

Member Avatar for WaltP
0
128
Member Avatar for atticusr5

Hey everyone, I am using Visual Studio 2008 to debug some code where the goal is create a linked list using pointer variables. Here is the main error I am getting when trying to compile: [CODE] error C2227: left of '->Account' must point to class/struct/union/generic type type is 'Link_t' [/CODE] …

Member Avatar for atticusr5
0
124
Member Avatar for i_luv_c++

hey guys...my code is working fine..only problem i have is my first do-while loop doesnt work...every time i try to compare the word given by the user to 'q' ||'Q'...it gives an error saying no match for the operator..please help me ....thanks! [CODE]#include <iostream> #include <string> using namespace std; bool …

Member Avatar for i_luv_c++
0
124
Member Avatar for mattjbond

I am curious about how to post or have published tutorials. I have searched the forum but the latest information I cna find is years out of date. Any help here?

Member Avatar for mattjbond
0
90
Member Avatar for richman0829

isalpha and ispunct work punctiliously, but isspace spaces out. [CODE] cout << "Please enter an integer: "; cin >> str; int bogus = 0; for (int i = 0; i < str.length(); i++) { char temp = str.at(i); if (isalpha(temp) || isspace(temp) || ispunct(temp)) { cout << "Please try again!" …

Member Avatar for richman0829
0
291
Member Avatar for windany

This code : ...line 6... [code] #include "FileToVector.h" #include "VectorToIntArray.h" #include <string.h> #include <iostream> using namespace std; int main(int argc, char *argv[]){ char* in = argv[1]; FileToVector ftv = FileToVector(in); vector<char> v = ftv.fileToVector(); VectorToIntArray vt = VectorToIntArray(v); //int* a = vt.letterFrequencies(); cout<< v.size(); return 0; } [/code] produces this …

Member Avatar for windany
0
99
Member Avatar for dillinger88

HI, I'm relatively new to programming in C++. I'm pretty solid in C and Java though. Anyway, I'm trying to create a class, Mesh, that has a vector full of my other class, Node, however the compiler doesn't seem to like it. I've looked through the console message but I …

Member Avatar for dillinger88
0
198
Member Avatar for dmane

Hi All, I am trying to learn stl to have some knowledge of how things work. I have just covered some basics and I have come to a block. I will explain what I am trying to do. I have a class that performs some basic operations on its member. …

Member Avatar for mattjbond
0
127
Member Avatar for iamvish

Hi all I want to use GetProcessMemoryInfo to get current memory used by my process..then which PROCESS_MEMORY_COUNTERS (which it takes as argument and return information in it)member is useful.. Please help me...

Member Avatar for Narue
0
70

The End.