49,761 Topics

Member Avatar for
Member Avatar for fhast

hi, everyone i want to ask about EOF in C++ when i learn C to use EOF in my code is like this : [CODE] while (scanf("%d",&a) != EOF){ statement ... } [/CODE] but, when i use in C++ { [CODE] while ((cin >> a) != EOF){ statement ... } …

Member Avatar for strmstn
0
131
Member Avatar for sasaB

[code] #include <iostream> #include <string> using namespace std; class GuessAccount { private: string guestname; int guestid; double internetbill; string entrydate; int nodays; int noguest; double presentfees; double totalfees; public: void setguestname(); void setguestid(); void setinternetbill(); void setentrydate(); void setnodays(); void setnoguest(); void setpesentfees(); void settotalfees(); void displayinfo(); }; //implementation section …

Member Avatar for strmstn
0
71
Member Avatar for BobC22

Hi im continuing to practise for c++ for when I go to uni next year and i have a problem with a practise example I have been given. I have set it up so the user can define the shapes and size etc, but I am unable to work out …

Member Avatar for mattjbond
0
817
Member Avatar for iamvish

Hi ,, I am using [B]GetProcessMemoryInfo[/B] windows api to get current memory usage by process.. It takes [B]PPROCESS_MEMORY_COUNTERS[/B] pointer as argument. I got value values in [B]PPROCESS_MEMORY_COUNTERS[/B] structure member after calling this api.. but what is the actual memory consumed by my process........ Is it [B]Working set size[/B] or [B]Page …

Member Avatar for tetron
0
172
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 team_ferrari22

Hi All, Does anybody know how to [B]defragment windows registry[/B]. We googled and found several free tools doing the same.But no tool is having open source. One tool is there - '[U]UltraDefrag[/U]' which is open source tool written in 'C' for file defragmentation. Please provide help in searching open source/ …

Member Avatar for team_ferrari22
0
97
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
200
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
120
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
127
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
202
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
66
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
635
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
155
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
162
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
88
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
113
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
109
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
224
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
137
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
133
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
132
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
91

The End.