49,761 Topics
| |
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 ... } … | |
[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 … | |
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 … | |
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 … | |
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 … | |
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/ … | |
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; … | |
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 … | |
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 … | |
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 << … | |
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 … | |
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; … | |
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 … | |
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! | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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); … | |
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 … | |
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 … | |
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 … | |
[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 */ | |
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’ … | |
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 … | |
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 … | |
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] … | |
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 … | |
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? |
The End.