49,761 Topics
| |
Hello I am newbie to C++ and I am testing my first loop using a switch statement. I want the loop to run nonstop until the user quits the program. [CODE] #include <iostream> using namespace std; int main() { char answ; cout << "Yes or No(y/n)" << endl; cin >> … | |
Note - I'm still learning c++... so there could be better ways of coding this. Try not to introduce new concepts - this will only aid in confusing me more, but please be more than welcomed to tell that i'm using something incorrectly. [CODE]// Classes - Using class to design … | |
How do I multiply two arrays? Assuming that the numbers in the arrays are all single digit integers, which makes the array a big integer. Now I want to multiply these two big integers formed from arrays and also at the same time display steps. Please don't use multidimensional arrays … | |
Hey, i was reading up on find function and i came across this line. size_t find ( const char* s, size_t pos, size_t n ) const; Correct me if im wrong, but it basically allows us to search a string based on the information inside an array right? After searching … | |
I have been trying to do this assignment for the past 4 days. I thought I was doing good but the functions seem to be screwing up. All the greater than and less than functions are messing up. Also the add and subtract functions are messed up. Any suggestions would … | |
i have a program that generates a grid of 20x20 using a 2d array, it then populates it by randomly generating 2 numbers as co-ordinates, and then filling it with either an 'x' or an 'o' it has a maximum of 5 x's and 100 o's. What i need it … | |
I have never posted to a forum before. I am taking a beginning C++ prgmming class. I am getting the error "error C2181: illegal else without matching if " I have tried everything I can think of to fix it, I can't tell if its a syntax error (such as … | |
Hi, I have a .txt file named: myTextFile.txt on my hostingaccount that contains this string: "Hello" Now my hostingprovider says this: "Any file that you can access via your domain can be accessed through a Secure Socket Layer (SSL) connection as well." When I type this manually in the address … | |
My program is to display a menu choice for the user, they will then pick one of the choices and the program will perform a calculation for the user. It contains four functions (menu, sum, power, and gcd) and it must contain reference parameters...i have most of the program, it … | |
I've got a constructor that sets some floats (x,y,z) and then I have a function called setXYZ. Now the constructor and the function do exactly the same thing. What's the best thing to do in this situation? Should I put the code in the function then call this from the … | |
I saw the following sentences from a book “A difference between a destructor and other member functions is that, if a regular member function has a body at the derived class, only the version at Derived class gets executed. Whereas in case of destructors, both derived as well as base … | |
can anyone help me with this c++ program? its a little much but i would really appreciate it Project specifications: Create a 2-player game that utilizes the “a s d f” and “4 5 6 8” keys on your keyboard. It would be a modified rock, paper, and scissors game, … | |
there are some problems in my coding which showing errors C2664 and C2562. i have no idea how to fix it...wish someone can point the problems and solutions too... [CODE]#include <iostream> using namespace std; const int listSize = 10; void fillArray(int list[],int listSize); void largest(const int list[],int listSize); void printArray … | |
[CODE] #include <iostream> #include <string> #include <iomanip> using namespace std; // //CLASS DECLARATION SECTION // class EmployeeClass { public: void ImplementCalculations(string EmployeeName, int hours, double wage); void DisplayEmployInformation(void); void Addsomethingup(void); string EmployeeName; int hours , overtime_hours, iTotal_hours, iTotal_OvertimeHours; double wage, basepay; double overtime_pay, overtime_extra; double iTotal_salaries, iIndividualSalary; }; int main() … | |
Hi I am attempting to write a code that will input the name of a file and output the number of times each letter appears in the file, and it is case-insensitive.For example : a|A : 5 b|B : 3 c|C : 0 d|D : 7 e|E : 0 so … | |
can anyone point what is wrong with my RegQuerryEx() function? Altough it return 0 :| [CODE] char buff[3] = {0}; DWORD size = sizeof(buff); DWORD type; if(RegOpenKeyEx(HKEY_CURRENT_USER , "Software\\vBx" , 0 , KEY_QUERY_VALUE , &hkey) == ERROR_SUCCESS) { if(RegQueryValueEx(hkey , "log" , NULL , &type , (LPBYTE)buff , &size) == … | |
Hey guys, i am having a huge problem checking the data i input to make sure it is correct. What i am trying to achieve is when i input a value, it will check if the input is all digits and if it is not, check to see if it … | |
I am kind of new to c++, i usually code in java and php. This is a program that is supposed to read in an input file with very strict syntax that will either create a new stack/queue (implemented subclasses of simpleList), or push a value onto one of those … | |
I have been recently experimenting with Python embedding, but I stumbled across some problems. [CODE]#include <python3.1/Python.h> int main (void) { Py_Initialize (); PyRun_SimpleString("print (\"Hello World\")"); Py_Finalize (); return 0; } [/CODE] As you see it is not the most complicated code :). I have compiled in Code::Blocks using g++. I … | |
Hey guys, i was looking through the internet for ways on how to solve converting roman numerals into integers and i found this method which is confusing me as im not able to understand it. [CODE]using namespace std; int main() { char rom; int n = 0; int tot = … | |
Hi all, I've been working with C semaphores for a while using shared memory (ftok, semget, semop, semctl) and it works perfectly. However, I was wondering wether using these structures all processes are protected against starvation. I have made several tests with nearly 200 processes sharing a binary semaphore and … | |
Volunteer C++ Gurus. Thank you in advance for your time. This site has saved my sanity. I am working with my longWords function and cannot get it to stop displaying the same value (2293264). I know that my code is a little janky because I modified it from array format … | |
sorry that i don't know i post on a correct place or not..=D my question is: How can i use the adjacency matrix like A B A 0 1 B 1 0 and write it to form of adjacency list like A -> B B -> A Hope you all … | |
I'm trying my best to learn linked lists but am having a difficult time understanding them exactly any way debugger returns SIGSEGV Debug Info: [code] Registered new type: STL String Registered new type: STL Vector Setting breakpoints Debugger name and version: GNU gdb 6.7.50.20071127 Child process PID: 1572 Program received … | |
[CODE]#include <cstdlib> #include <iostream> #include <string> #include <fstream> #include <sstream> #include <cstring> using namespace std; int main(int argc, char *argv[]) { fstream filestr; for (int i=1; i<=17771;i++) filestr.open ("mv_0000001.txt", fstream::in | fstream::out | fstream::app); filestr.close(); system("PAUSE"); return EXIT_SUCCESS; }[/CODE] guys i m trying to create multiple text files to the … | |
Hello everyone, Are there any approaches to invoke Java libraries from C/C++? Thanks in advance, George | |
If anyone can take a second to view my code, I would really appreciate it. I've been working on this for days. I think I am so so close. Its the Knights Tour (Knight must move to every spot on board without moving to one spot twice). It breaks when … | |
Hi. So i have to do the program where we read from a file a certain amount of numbers(not more than 100), and then perform either a bubble or selection sort and a linear or binary search. I wrote the thing down and it read fine, but I can't get … | |
Ok, so I have some code from my HugeInteger problem again. Like the title says this is totally backwards. I keep getting the exact wrong result than what should be given. I could probably sneek by the graders with it, but now it is really got me wondering. When I … | |
Hey all. I'm having trouble developing an order program. Basically I have to compare two files, and validate that one equals the other. I have figured out how to determine whether the order data is valid or not, but i'm unsure how to go about writing out which pieces of … |
The End.