49,761 Topics
| |
Title pretty much sums it up. All I want it to do is be able to compare the text from two char variables. So here's my code: [CODE]#include <iostream> #include <windows.h> using namespace std; int main() { system("color 04"); char symbol[100]; char answer[100]; int i; i = 1; cout <<"Enter … | |
I am getting a big problem at the end of my arrange function. It reads the last line of code in the function, but then never leaves the function. I don't care about output at this point. I just want to figure out why I can't leave the function and … | |
Ok so for this assignment I have to have integer input in string and convert to integer..done: [CODE]int n, digit; cout << "Enter a number: "; cin >> snum; n = 0; int power = pow(10, snum.length()-1); for (int i=0; i<snum.length(); i++) { digit = snum.at(i) - '0'; n = … | |
Ok so when makeing my program these errors come up: Error:jump to case lable Error: crosses initialization of 'std::ofstream a_file' The ofstream one repeats twice referring to the same line. Can anyone help me. I can't post the code as this is from my iPod. | |
How much longer until I'm the king of typos and stupid questions? Ok well in a different thread of mine there was a reference to BIOS.h. Does anyone know where to download it (If I don't have it comp making tarball sooo slow) or/and what's in it. I want to … | |
i am planning to start learning how to use threads. my question is: should i first learn windows.h's functions for threading before boost to get the pattern or should i jump right to the boost threads? ps: sry if i posted in the wrong section | |
hey alll..I posted earlier on needing help for a code on input #..base..print decimal form..I actually didnt learn this in high school so thats why I was having so much trouble :@ Now that I read up and understand the logic in bases..I was thinking that for my code I … | |
Hi! I don't understand why I can't use my functions declared like this: [CODE]#include "groundArray.h" int groundArray::getlistX(int i) { return x; } int groundArray::getlistY(int i) { int groundlistY[] = {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; return groundlistY[i]; } int groundArray::getlistWidth(int i) { int groundlistWidht[] = … | |
It's my first time to use functor. So hope can get some guide here. My program need to call different function depend on input. so i thinking to use functor to do that. e.g. main.cpp [CODE]#include "functor.h" #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { … | |
Hi All, I want to trap inRange and outRange event of the bluetooth device i.e. paired with my windows7 machine. Thanks in advance. | |
Hi, I'm a beginning C++ student and have an assignment to dynamically create an array of a struct to store students' first names, last names, and test grade scores, and then pass it via pointer to a function that will sort the grades and names in ascending order. I wrote … | |
| |
Hi I have a code as follow: [CODE] template<class T> inline bool IsValidUnsignedLong(T n) { return (T)(unsigned long) n == n; } [/CODE] When I pass -l to that function, it returns TRUE which it shouldn't since its not unsigned. Can anyone explain to me the reason behind this? why … | |
I've been looking and I'm a bit lost about how to change the target of ostream so that I could write to other buffers than the console. | |
I've managed to use classes in separate files before, but I can't seem to get it to work here. I was just programming some very basic classes for a simple game I wanted to make. Here is the main.cpp file: [code]#include <iostream> #include "energySystem.h" #include "healthSystem.h" #include "intelligenceSystem.h" using namespace … | |
In writing a logfile program, I need a function to output the log entries between two dates. I use [ICODE]seekg()[/ICODE] and [ICODE]tellg()[/ICODE] to save the position of the first entry to output and last entry and then go back later to output the data in between. However, [ICODE]seekg()[/ICODE] when told … | |
Ok how do I make a C++ console app format a floppy disk for a Win or Linux Computer? I really want it to be auto-matic like without the whole volume tilte, filesystem; that sutff. PS How would I setup virtual memory in linux? Thanks answer the floppy question first. … | |
My program is in an infinite loop, when It hits the "Bye" part in the code it goes right back up to the top. Help with this. It's a pretty simple program so I can't see what I did wrong. [CODE]#include <iostream> #include <windows.h> using namespace std; int main () … | |
Hey, I have a set of types which are all arithmetic (have operators for addition, subtraction, multiplication, etc.). I want to aggregate any number of them into a single object, so I'm using the std::tuple class template and the <tuple> library (and Boost.Tuple for backward compatibility). My question is a … | |
[CODE] boost::shared_ptr<resource> resource_ptr; boost::mutex resource_mutex; void test() { if(!resource_ptr) //#1 { boost::lock_guard<boost::mutex> lk(resource_mutex); if(!resource_ptr) //#2 { resource_ptr.reset(new resource); //#3 } } resource_ptr->do_something(); } int main() { boost::thread t1(test); boost::thread t2(test); t1.join(); t2.join(): return 0; } [/CODE] According to the text book, this kind of codes may cause race condition, but … | |
Ok so i have trouble with looping with while and for statments heres the questions: 1. Write a program that gets a positive integer from the user and prints all the numbers from one to that integer. If the inputted number is zero or negative, then the program will print … | |
Ok heres what I want to do: I want to put a file in a console application (during compileation\codeing not running) and when it runs it saves the file in the same place it was run from. Like moving a movie as an exe to hide it while it is … | |
i have a code written in c++/Cli (CLR Console app) that uses .Net framework. it basically uploads a file to a ftp server. i wanna run it on computers that dont have .net framework. and are running windows xp or windows 7. can i somehow convert it into win32 console … | |
Hi, I am trying to a play a .wav file in a C++ program. I think my code is OK, but when it plays, it plays the default windows 'error' sound, not my .wav file. This is the program: [code] #include <iostream> #include <windows.h> #include <mmsystem.h> #pragma comment(lib,"Winmm.lib") using namespace … | |
friends i m using vc++ 6.0 and oracle 10g version.i created mfc file and connected database. i done insert and delete operation.but i cant check or view the data(table).can you any one tell how to do? and any other option 2 view the database thanking you | |
Well im having this problem on how to add large integers. I have used strings to take in a very large number something that can work on as many digits as you need it to. I take in 2 strings for the numbers you want to add. After which I … | |
Hi, I am almost done with C++ and my project is on Resistors. The problem is that when i try to tun the program, line 37 and 34 has an error saying "no match operator". It is the same as line 28 and 31. Then when I make line 34 … | |
What I would like is when I input the file path in the console window (lets say C:\hello.txt), I would like it to create, open, then write text into the file. Here's an example of my code. [CODE]#include <iostream> #include <fstream> #include <string> using namespace std; int main () { … | |
I am trying to learn c++ from a textbook (as so many others) but am having a really hard time following this example: Write a program to input and display a sales file. Each input line contains an integer ID number and a sales amount. When the end of the … | |
What does it mean if there is an ampersand right before the function name? Something like: int& myFunction(int& a, int& b) Also my book said something about how it doesn't create a copy of something if you pass it by reference, but what exactly does that mean? I never understood … |
The End.