49,761 Topics

Member Avatar for
Member Avatar for valestrom

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 …

Member Avatar for WaltP
0
106
Member Avatar for bennetk2

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 …

Member Avatar for WaltP
0
213
Member Avatar for meli123

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 = …

Member Avatar for WaltP
0
144
Member Avatar for Zssffssz

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.

Member Avatar for pseudorandom21
0
107
Member Avatar for Zssffssz

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 …

Member Avatar for pseudorandom21
0
326
Member Avatar for dospy

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

Member Avatar for dospy
0
247
Member Avatar for meli123

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 …

Member Avatar for VernonDozier
0
150
Member Avatar for Allander

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[] = …

Member Avatar for MonsieurPointer
0
212
Member Avatar for murnesty

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[]) { …

Member Avatar for Eagletalon
0
163
Member Avatar for mdheerajgupta

Hi All, I want to trap inRange and outRange event of the bluetooth device i.e. paired with my windows7 machine. Thanks in advance.

Member Avatar for Eagletalon
0
191
Member Avatar for eviandc

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 …

Member Avatar for eviandc
0
1K
Member Avatar for mahesh vidhate
Member Avatar for markfw

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 …

Member Avatar for mike_2000_17
0
198
Member Avatar for ChaseRLewis

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.

Member Avatar for mike_2000_17
0
107
Member Avatar for ben1996123

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 …

Member Avatar for ben1996123
0
555
Member Avatar for iamthesgt

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 …

Member Avatar for iamthesgt
0
273
Member Avatar for Zssffssz

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. …

Member Avatar for Moschops
0
168
Member Avatar for valestrom

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 () …

Member Avatar for Zssffssz
0
162
Member Avatar for mike_2000_17

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 …

Member Avatar for mike_2000_17
0
521
Member Avatar for stereomatching

[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 …

Member Avatar for stereomatching
0
179
Member Avatar for Adam Ma

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 …

Member Avatar for cherrymae.calma
0
166
Member Avatar for Zssffssz

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 …

Member Avatar for pseudorandom21
0
110
Member Avatar for cent91

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 …

Member Avatar for thines01
0
285
Member Avatar for Carrots

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 …

Member Avatar for pseudorandom21
0
6K
Member Avatar for vrs1155

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

Member Avatar for thines01
0
134
Member Avatar for grimreaperx2

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 …

Member Avatar for grimreaperx2
0
1K
Member Avatar for Tinee

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 …

Member Avatar for diamondw
0
154
Member Avatar for Tom_Weston

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 () { …

Member Avatar for Tom_Weston
0
104
Member Avatar for sgiusti88

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 …

Member Avatar for NathanOliver
0
306
Member Avatar for NoUserNameHere

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 …

Member Avatar for mike_2000_17
0
107

The End.