49,767 Topics

Member Avatar for
Member Avatar for asphp

I'm making a tick tack toe game for a programming class and i*m stuck with some problems. Problem 1: rand sometimes returns a value over the max value. Max is 9 and it can return up to 1000000 on some occasions. Problem 2: The Win function only works in player …

Member Avatar for asphp
0
125
Member Avatar for wheel

Hello! I'm wondering how to go about packing data from an std::vector<unsigned long> into valid unicode (UTF-8) characters. So far, I've tried writing the unsigned long data directly to a text file, but that usually results in invalid characters. (I don't actually need to store the data in unsigned long …

Member Avatar for wheel
0
186
Member Avatar for ridd

Hi I have some code that is supposed to take an array of booleans and for each `(int minBits = 10)` bits turn the binary number into decimal. The algorithm is working in part, but the bit at `binArr[64]` where when is somehow changing in between when I print the …

0
45
Member Avatar for Miganders

so, iwe been messíng arround with C++ for about 4 days now and here is my first real print all squarenumbers (it will break at a point) : [code]#include <iostream> #include <windows.h> //---------------------------- using namespace std; //---------------------------- int main () { string numbers="1"; bool on = true; do { cout …

Member Avatar for Miganders
0
170
Member Avatar for sixstorm1

Hi everyone, I have a modal dialog box which is called by the main thread. This dialog has no parent (appears at center screen, overlapped, and shown in taskbar). When the user clicks "Save" in the dialog, the dialog procedure receives the command and displays a save file dialog (GetSaveFileName). …

Member Avatar for sixstorm1
1
245
Member Avatar for Miganders

[code] #include <iostream> #include <windows.h> //---------------------------- using namespace std; //---------------------------- int main () { long int numbers=1; bool on = true; while (on==true) do { cout << numbers*4; numbers = numbers+1; Sleep(500); } }//--breaks here [/code] how come the loop not work?

Member Avatar for Miganders
0
109
Member Avatar for networkmancer

Now im getting Declaration Syntax Error on line 155. Please help need urgent . [code] #include <stdio.h> #include <conio.h> #include<process.h> #include<dos.h> void graph(); void foo(){ int a,b; clrscr(); gotoxy(27,12);textcolor(12);cprintf(" "); gotoxy(40,14);textcolor(12);cprintf(" "); gotoxy(29,16);textcolor(12);cprintf(" "); for(a=1;a<=72;a++){ gotoxy(5+a,2);printf("Í"); gotoxy(5+a,23);printf("Í"); } for(b=1;b<=20;b++){ gotoxy(5,2+b);printf("º"); gotoxy(78,2+b);printf("º"); } for(int s=1; s<=3;s++){ gotoxy(41,2+s);printf("º"); } for(int o=1;o<=72;o++){ gotoxy(5+o,5);printf("Í"); …

Member Avatar for Ancient Dragon
0
241
Member Avatar for jBat

Hi, I'm just starting to practice with c++ and I'd like to know if there is a good way to handle the errors/exception. I write this program to check the modification time of a file. Thanks [CODE]int filewatcher::watch() { struct stat filestatus; stat(this->_filename, &filestatus); if((filestatus.st_mode & S_IFMT) == S_IFREG) { …

Member Avatar for Nick Evan
0
152
Member Avatar for touqra

Hi, I don't understand why I failed to insert vectors as an input of a function. I wrote : void fun( std::vector<double> do, int &count ){ ... } but it doesn't compile...

Member Avatar for Narue
0
119
Member Avatar for networkmancer

I need to put this one in my case 5 [code]#include<stdio.h> #include<conio.h> #include<process.h> float rate,day,gp,netpay,totald,sss,med,love;int age; float basic,cola,tax;char employee[20],addr[30],sex[10],bday[8]; void main(){ clrscr(); char choice; gotoxy(20,2);textcolor(4);cprintf("Payroll System"); gotoxy(20,4);textcolor(5);cprintf("Select Choices:"); gotoxy(18,6);textcolor(7);cprintf("[1] Add Customer Info"); gotoxy(18,7);textcolor(7);cprintf("[2] Compute Payroll"); gotoxy(18,8);textcolor(7);cprintf("[3] Display Information"); gotoxy(18,9);textcolor(7);cprintf("[4] Exit"); gotoxy(18,10);textcolor(7);cprintf("Enter Choice:"); scanf("%d",&choice); switch (choice){ case 1:printf("Employee Information\n\n"); printf("Enter Employee …

Member Avatar for Ancient Dragon
0
293
Member Avatar for basketball4567

Hi guys, I know that there might already be a tread about reading from file but this has a certain hurdle to jump... I have to read in a 1000 word document into something that will make a list of unique words and how many times they appear. Thats not …

Member Avatar for jencas
0
118
Member Avatar for rahul.agrawal

Hi All.. I want to generate a dialog bar or panel inside a window, for that i have seen a sample code somewhere (implemented on VC++ 6.0).. Now i am trying to use that code in visual studio 2008 but an assertion failed error is being occured..while i am using …

0
94
Member Avatar for Se7Olutionyg

[CODE]#include <iostream> using namespace std; class BigNum { private : int biggest; void determineBiggest ( int num) { if (num > biggest) biggest = num ; } public : BigNum () { biggest = 0 ; bool examineNum(int); int getBiggest() { return biggest; } }; bool BigNum::examineNum(int n) { bool …

Member Avatar for vmanes
0
145
Member Avatar for Der_sed

I know that an array matrix would have been better but Im taking a freshman course so coulnt use it. 1- Tic tac toe grid is defined from locations 1 to 9 2- For loop executes 9 times for 9 turns 3- A functions takes all 9 locations as argument …

Member Avatar for DdoubleD
0
144
Member Avatar for kyosuke0

Iv always had trouble with templates and I always get the same error message "Error: Templates can only declare classes or functions." program is a template linked list class and I'm using the sun studio 12 C++ compiler linkedList.h file: [CODE]#include "nodeType.h" using namespace std; template <class Storeable> class LinkedList …

Member Avatar for DdoubleD
0
266
Member Avatar for atch

Hi, I know that this topic was discussed previously but those previous threads didn't answer to my question which is: How to change color of this text: [code=c++] cout << "Some text" << endl; [/code] when I'm outside of main, i.e. in file with my class and in one of …

Member Avatar for atch
0
278
Member Avatar for rena0514

I have a program where i have to use partial array intialization to read data from a file and place it into an array...there is no example of this in my class book and i'm confused!

Member Avatar for DdoubleD
0
113
Member Avatar for Miganders
Member Avatar for Miganders
0
259
Member Avatar for KIEX

a program that parks in C++,takes the detail of passengers,driver,the car store in the link list class a pass,class acar,class aparkinglot

Member Avatar for Salem
0
112
Member Avatar for AbsoluteCPP

We have seen websites using Flash, very cool Menus, slides and much more. How to do this in C++. I am making a Contact Book. I want to create eye chating cool look GUI for it's front end. I have made a class named ContactManager this class get contact information …

Member Avatar for Ancient Dragon
1
158
Member Avatar for robtech

Anyone got any pointers on the interpretation of REG_BINARY data such as the ascii strings that are stored as binary values in HKEY_CURRENT_USER "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RecentDocs\\folder"; I have long mastered most of the Win32 Registry functions but never really had the need to delve into the murky depths of binary. I guess …

Member Avatar for robtech
0
255
Member Avatar for prodigyaj

I am trying to find the sum of integers ( (int)(a*i)/b ) where i is from 0 to 10^10. The problem is a/b >=1 and can be a fraction also and a and b are constant If it wasnt a fraction then it was really easy i*(i+1)/2 * a/b Any …

Member Avatar for Sky Diploma
0
115
Member Avatar for bunnyboy

Can someone explain what am I doing wrong? I get "vector subscript out of range" error. Here is the sample ... [CODE=cplusplus] #include <vector> using std::vector; struct CUBE { int number; bool changed; }; int _tmain(int argc, _TCHAR* argv[]) { vector<CUBE *> cube; for (int i = 0; i < …

Member Avatar for bunnyboy
0
4K
Member Avatar for himgar

I had written a program [code] #include <fstream.h> void main() { fstream f; f.open("test.txt",ios::app|ios::in|ios::binary); cout<<f.tellg(); f.close(); } [/code] My file test.txt already contains text : " hello " i.e. 5 characters But when i try this it outputs only 0 but ios::app mode places the pointer at the end of …

Member Avatar for Salem
0
85
Member Avatar for Belthemet

[B]#Off topic[/B] When I was logging in, I have noticed 600,00x members registered on this forum. Congrats on the 600k! ;) Hello. My console game is going pretty well, even though I don’t have much spare time to expand it. I have some ideas I would like to add, but …

Member Avatar for Belthemet
0
261
Member Avatar for gretty

Hello I am making a function that takes in a date (dd/mm/yy) & returns what week number of the year the date occurs on. For eg; If I enter: 01/01/09 then the week number of that year will be 1 If I enter: 04/09/09 then the week number of that …

Member Avatar for gretty
0
2K
Member Avatar for prashantsehgal

hello this is prashant. well i need to find some helping materials online on WTL coz even microsoft site isnt having any sort of documentation in this.also can someone give me few examples in this as to how to create a dialog boxes & few other stuff.thanks in advance.

Member Avatar for Ancient Dragon
0
71
Member Avatar for Epi23

Hey everyone, I'm just now learning c++ and was wondering if there was a way to loop this program so that I don't have to copy and paste it. I got it to work, but I was just curious if there was another way to do it. it just does …

Member Avatar for Epi23
0
103
Member Avatar for gopi17

ok...i'm having trouble changing a value in a array into a character [CODE] void gameon(int **game,int &size,int &x,int &y,int &score1,int &score2) { int i,j,num1,num2; cout<<"Please enter a number from the selected row/column -->"; cin>>num1; for(j=0;j<size;j++) { if(num1==game[x][j]) { cout<<"Number found"<<endl; game[x][j]=='X'; score1=score1+num1; y=j; } } display(game,size,score1,score2); } [/CODE] i can't …

Member Avatar for vmanes
0
117
Member Avatar for iammfa

Hi, i'm using c++ with SDL, SDL image libraries, i trying build a small example, i got this error in linking when i build every project: ------ Build started: Project: 00000, Configuration: Debug Win32 ------ Linking... MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup C:\Users\iammfa\Documents\Visual Studio …

Member Avatar for John A
0
160

The End.