49,756 Topics

Member Avatar for
Member Avatar for lewashby

I'M working my way through a C++ book and now I'M doing a card deck program. Here's the line I'M having trouble with. r = card % 13; // r = random 0 to 12 card in this case is just a random int number from 0 to 51. 52 …

Member Avatar for TrustyTony
0
156
Member Avatar for merse

I would like to use an unsigned integer type for indexing a vector, but I want to use the best and optimal on every platform. How to implemet?

Member Avatar for L7Sqr
0
123
Member Avatar for XodoX

I think this has something to do with process scheduling. (1st process) Start 0// starts at 0ms Run 10 // runs for 10 ms Disk 0 // no idea what this does, but it takes 10 ms Run 30 // run 30 ms End // terminates (2nd process) Start 5 …

Member Avatar for asrockw7
0
190
Member Avatar for RonKevin

Okay, its been a while since my last visit here..and yes I need your help with C++ Programming... My grades were fine so that's all thanks to you guys....so here's my next question.... What is wrong with my code? My exponent displays a wrong number... I used a for loop …

Member Avatar for RonKevin
0
308
Member Avatar for lewashby

#include <Stdafx.h> #include <iostream> #include <stdlib.h> #include <time.h> #include <math.h> using namespace std; int rand_0toN1(int n); int hits[10]; int main() { int n; int i; int r; srand( static_cast<unsigned int>(time(NULL))); // set seed for random numbers cout<< "Enter number of trials to run "; cout<< "and press ENTER: "; cin>> …

Member Avatar for VernonDozier
0
166
Member Avatar for laura90

I'm trying to write a simple linked list program. The header files are compiling successfully, but when I try to compile my driver program to test the program, I'm getting an error. Here's my driver program: #include <iostream> #include "Node.h" #include "List.h" using namespace std; template <typename T> void fill(List …

Member Avatar for mike_2000_17
0
379
Member Avatar for boris90

Hi, I need a program to search all lines of a file (a whole file) for a certain string. In my concrete case, I need it for login. Let me sum all of this up, so you get the whole overall point of what I have so far: - a …

Member Avatar for Moschops
0
654
Member Avatar for blitzkrieg64

I'm trying to access the pixel colors from a image file but can't seem to get it to work properly, my program is only accessing the pixel colors from my active window. I've been stuck on this for a few days and would really appreciate any help. I'm guessing i …

Member Avatar for Moschops
0
277
Member Avatar for new_developer

hi everyone, I am trying to initialize array in main method, and insert value in array in another method named "popArr()", in last print array in "printArr()" method. But its not working and i am getting errors. The environment i am using borland c++. The code is as follows. #include …

Member Avatar for Lucaci Andrew
0
164
Member Avatar for godzab

Here is the code first: People.cpp #include "People.h" #include "Birthday.h" #include<string> #include<iostream> using namespace std; People::People(string x, Birthday bo) : name(x), birth(bo) { } void People::People() { cout << name << "was born on" << birth.printDate(); } People.h #ifndef PEOPLE_H #define PEOPLE_H #include<string> #include "Birthday.h" class People { public: People(string …

Member Avatar for triumphost
0
131
Member Avatar for Qusto

Hi! Created application is working toooo slow, looks like there are a lot of memory leaks, there are a lot of pointers. So, please, can you advice some effective tool for run-time errors and memory leaks detection in Visual Studio C++?

Member Avatar for Topiary
1
148
Member Avatar for ztdep

Dear friends: i have a data file, the structure of the file is as follows: // data.txt $Elements 1 1 2.5 2 2 1.0 2.0 3 2 3.0 4.0 4 4 1.0 3.2 2.7 1.6 $EndElements In the data.txt, the fisrt column is the row number, and the second column …

Member Avatar for Branickiod
0
111
Member Avatar for sniper29

how can i make an array inside by a function????? so that the value i will input will change.... I am using Borland C++..... how can i start it???? 1. [SOLO] Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of …

Member Avatar for YoDjinthehouse
0
587
Member Avatar for ASFtlink

This program ask user which arithmetic operation they want to play with then generates a random equation and lets the user answer it. When the user stop playing the game the program calculates the number of correct and answers and wrong answers. I need some help because the program crashes …

Member Avatar for Lucaci Andrew
0
305
Member Avatar for poloblue

Good Afternoon, I'm getting this errors on the program: warning C4244: 'argument' : conversion from 'double' to 'const int', possible loss of data warning C4244: 'argument' : conversion from 'double' to 'const int', possible loss of data warning C4244: 'argument' : conversion from 'double' to 'const int', possible loss of …

Member Avatar for Schol-R-LEA
1
1K
Member Avatar for dan_code_guru

Ive just recently switched to visual studio c++ express. I am Creating some shapes with dx9 and i came upon this problem with my indices: error C2064: term does not evaluate to a function taking 24 arguments here is the code where i am getting the error: [ICODE]short indices[100]; indices[100] …

Member Avatar for dan_code_guru
0
768
Member Avatar for MrEARTHSHAcKER

Hi, I need little help with using MediaPlayer from System tab in Borland Builder 6 for C++. Does anyone know what member function of MediaPlayer returns bool variable which tells us is music currently being played or not? I have seen solution for this problem where we use Timer which …

0
119
Member Avatar for infinityblade

Hey guys, So I really need help writing a c++ program that is supposed to read in values for Red Green and Blue colors between 0 and 255, and then use a different function to convert them to Cyan Magenta Yellow and blacK color using set formulas. 1. Write a …

Member Avatar for triumphost
0
3K
Member Avatar for rbean10

I am creating a program to decrypt the line of code ":mmZ\dxZmx]Zpgy" with ASCII method. What I have so far translates individual characters perfectly. But I can't seem to translate whole lines/words. Everyway I've tried gives an error somewheres. I think I need to use cstring or string. Any tips …

Member Avatar for Moschops
0
554
Member Avatar for akshay.lahiry

Hi Guys I am trying to create a global object instance and am currently running into a segmentation fault while accessing a member variable. I have a capture.h file and a capture.cpp file //In capture.h struct ringinfo { // a simple struct }; class capture_manager{public: func1(); func2(); ringinfo ringinf ; …

Member Avatar for akshay.lahiry
0
3K
Member Avatar for lightningfire

I am trying to learn C++ and am trying to figure out how to use strings and if statements together. Here's the code I'm trying to play around with: [CODE=c] #include <iostream.h> int main() { char * a; cout << "Do you want to enter?\n"<<endl; cout << "To enter, type …

Member Avatar for sftranna
1
11K
Member Avatar for chamnab
Member Avatar for Perry31
0
216
Member Avatar for poloblue

Good Afternoon, I 'm new to C++ programming, and I have to do a program that deals with nested loops. Can anyone please check the code that I have for PART C and PART D of the program. Here is the code of the program. #include <iostream> #include <fstream> #include …

Member Avatar for TrustyTony
0
210
Member Avatar for poloblue

Good Afternoon, I want to convert this if-else statement to a switch statement. The if-statement is: int x; cout<<"GIve me an int and I tell you whether is even of odd "; cin>>x; if (x%2==0) cout<<x<<" is even."<<endl; else cout<<x<<" is odd."<<endl;

Member Avatar for poloblue
0
101
Member Avatar for poloblue

Good Afternoon, I'm having problems with this assignment that deals with loops that implements the continue statement. Can someone check the loops that I have implemented on Part B and Part C that must have the continue statement. Here is the code #include <iostream> #include <fstream> #include <string> #include <cstring> …

Member Avatar for mcriscolo
0
150
Member Avatar for dancks

So, I'm using allegro game programming library. Before I move on to bigger and better things I wnat to get a handle on pointers. Specifically with things like structs, linked lists and maybe binary trees in the future. I posted a program that uses a linked list to keep tracks …

Member Avatar for dancks
0
308
Member Avatar for poloblue

Good Afternoon, The program that I'm doing with function doesn't want to run, the error that pops out is: 'std::basic_istream<_Elem,_Traits> std::operator >><std::char_traits<char>>(std::basic_istream<_Elem,_Traits> &,signed char *)' Here is the code and header file that I have so far: CPP FILE #include <iostream> #include <fstream> #include <string> #include <cstring> #include <cmath> #include …

Member Avatar for poloblue
0
501
Member Avatar for triumphost

This works fine. For any type I create (Example): BoxArray& operator -= (const Box& B); BoxArray& operator -= (const BoxArray& BA); BUT when it comes to my literal types like char's and strings and char*'s, I get Ambiguous overloads: StringArray& operator -= (const std::string& S); StringArray& operator -= (const StringArray& …

Member Avatar for triumphost
0
133
Member Avatar for benikens

Hi, I'm currently trying to learn WinSock coding from http://johnnie.jerrata.com/winsocktutorial/ however when I compile my listening socket, I get 9 'error LNK2019: unresolved external symbol' errors. They all look to be the same function names that are used in the code prefixed with an underscore after the function name it …

Member Avatar for benikens
0
289
Member Avatar for addlebrains

Hi there. I've just written an extremely simple cross-platform wrapper for posix threads. I compiled it on unix and it compiles with no errors. The windows side... not so pretty. I'm using MinGW. gcc compiles fine but throws a couple of warnings at me (I'll explain in a bit.) g++ …

Member Avatar for ThoraxImpailor
0
226

The End.