49,761 Topics

Member Avatar for
Member Avatar for defender_

I am using this code for simply reading from a text file but i want to put file pointer at the begining again when it reaches to the end of file. But my code below is not working. u can ignore extra bits of my code... like header files... :) …

Member Avatar for ArkM
0
108
Member Avatar for lalafam

I am a student and am having trouble getting my for statement to work with an array. This is my first time here. Here is what have so far. Any tips would be greatly appreciated. [code=cpluslus] using namespace std; void main() {#include <iostream> // Emp is number of employees needed …

Member Avatar for lalafam
0
116
Member Avatar for Ray Gray

We came across a very strange behavior with a code like this (this is a simplified version; it took quite a time before we were able to identify a similar problem in our code): [code] unsigned int x = 10; int a = ((int-1) * x; int b = ((int)-1) …

Member Avatar for ArkM
1
100
Member Avatar for vuphong2002
Member Avatar for Peyton

Hi there, I'm having a problem with the code below: [CODE]#include <iostream> #include <cstdlib> #include <ctime> using namespace std; void setArray( float [], const int Size ); void displayArray( const float * ); int main() { const int arraySize = 20; float array[ arraySize ]; // Initialise the array: setArray( …

Member Avatar for Peyton
0
104
Member Avatar for an_ashu

hi any body know how to findout the difference of two binary files. i have twobinary files containing 1. i just find the differnceof these two text files,just want toprove that two text files are different if the difference is zero and vice versa.plzzzz helpme

Member Avatar for Ancient Dragon
0
62
Member Avatar for kaio-ken

[code=cplusplus] #include<iostream.h> #include<stdlib.h> int main(void) { char a,q; cout<<"Enter a char\n"; cin>>a; q=a; cout<<atoi(&a)<<","; cout<<atoi(&q); return 0; } [/code] ************************************* output for this code for input of (2 ,3,5): 2,22 3,33 5,55 **************************************... I think answers should be: 2,2 3,3 5,5

Member Avatar for pwl
0
121
Member Avatar for aarifameen

Problem Statement: 1. Create a BankTransaction class. 2. Create following static data members: Balance to show balance. New Balance to get New balance from the user. Adjustment in order to do the adjustment in balance. Annual Interest Rate is used for the calculation of the interest. Interest data member to …

Member Avatar for siddhant3s
-1
126
Member Avatar for bitki_1407

Hi All, I have created a program for calculating average of 4 numbers, however, Im getting an error as "Run Time Error 13 Type Mismatch" on the Click event of "Calculate Average" command button. The code written for the Click Event of "Calculate Average" command button goes as : Private …

Member Avatar for lordofhell
0
4K
Member Avatar for daino

I'm rather uncertain as to how you go from making programs which churn values on the Dos screen to actual graphics. I'm not asking for a lesson on this, but I am confused as to how a c++ program creates/manipulates graphics. Is it all done through widgets or is there …

Member Avatar for Prabakar
0
270
Member Avatar for p2009_d

Hi Friends, I am writing a monte carlo program. I have made a structure which had different 20 objects like ALA[5], CYS[5], PRO[5], ARG[34] , MET[15]....and so on. [code=cplusplus] //this is defined in a global.cpp file// typedef struct libaa{ int num; char amino[4]; float chi1,chi2,chi3,chi4,phi,psi,omega; }; libaa ALA[1],CYS[4],ASP[8],GLU[15],GLN[15],PHE[5],GLY[2],HIS[8],HIE[8],ILE[7],LYS[27],LEU[5],MET[13],ASN[9],PRO[3],ARG[34],SER[3],THR[3],VAL[3],TRP[7],TYR[5]; //in my …

Member Avatar for tux4life
0
96
Member Avatar for OffbeatPatriot

I've tried several times now to write my own neural network class and I think this is the closest I've gotten, the network seems to run properly but it doesn't seem to learn correctly. I'm trying to make it approximate exclusive or but it seems to be only capable of …

Member Avatar for OffbeatPatriot
0
148
Member Avatar for TheBattlizer

I'm trying to declare a structure definition in a header file so I can use the structure in other files, however I get the error: error C2011: 'Points' : 'struct' type redefinition from the file where the structure definition is declared. The structure is only defined in that header file. …

Member Avatar for ArkM
0
2K
Member Avatar for ttqtrang146

I've got code sections which write and read binary files. But when I print data reading from file. It appears unnecessary characters. [code=cplusplus] int WriteFile(const char* file_name) { fstream file(file_name,ios.out|ios.binary); if(file.is_open()) { string data_block="I don't understand!\nAdd one line"; file.write(data_block.c_str(),data_block.length()); file.close(); cout << data_block << "(" << data_block.length() << ")" << …

Member Avatar for ttqtrang146
0
177
Member Avatar for theashman88

Hi I'm working on a program that compares the users response to an answer like a quiz. At first I wasn't sure how to do this using cin because the answer was two words. Someone helped me out and showed me the getline command. The only problem is if i …

Member Avatar for theashman88
0
298
Member Avatar for ShaneM

I'm trying to create a Monopoly - style game in C++ using the Dev-C++ IDE, MinGW compiler. I actually wrote this game in BASIC on a TRS-80 back in the early '80s and it worked fine! I've attached a .txt of the code in question with the error codes given. …

Member Avatar for ShaneM
0
161
Member Avatar for goyofoyo

I made figures with * and when i display it once it works fine but if i try to display it again and again it, the botton of the figure is the only thing that shows I am not sure what is wrong with the loops? maybe someone can see …

Member Avatar for Lerner
0
120
Member Avatar for dumrat

Hi, I have a program, which has some worker threads that are performing tasks. The main thread assigns work to the worker threads. The worker threads wait for a message from the main thread (with data) and start to work. After completion of work, working threads again wait for more …

Member Avatar for Stinomus
0
76
Member Avatar for azjherben

No errors when compiling and I can comment out most of the main function and it still frezzes. Remove the SDL parts and it won't freeze up but then again the SDL is most of the program. CODE: [code] //Main.cpp #include <SDL.h> #include <iostream> #include "Socket.h" #include <fstream> #include <string> …

Member Avatar for azjherben
0
117
Member Avatar for Kev06N

Hi all, I'm quite new to C++!! I'm also having a bit of a problem with a for loop Its that I have an if statement inside a for loop [code]if (cuno == customers[i].custno)[/code] when I try to add an else within the for, it repeats the message 3 times …

Member Avatar for Kev06N
0
99
Member Avatar for fadia

Hello.. i've this HW.. i did what i can do.. but there were some errors that i couldn't fix.. and one point i dunnu how to do it which is change negative variables to positive ones?? can someone tell me how to code that? here is my code: [CODE]#include <iostream> …

Member Avatar for shindu
0
145
Member Avatar for TheBattlizer

How do you pass a structure array to another class? For example, I want to pass the structure array point[150] to a function in another class/source file. [CODE]#include... struct Points { int xCoordinate; int yCoordinate; int zCoordinate; } point[150]; int main(int argc, char **argv) { ... void DisplayPoints(); [/CODE] The …

Member Avatar for TheBattlizer
0
139
Member Avatar for serkan sendur
Member Avatar for serkan sendur
0
107
Member Avatar for saiaditya007

I want to send a string through a socket. So, i convert string into array of bytes. System::String ^st = "ÿÿÿÿdetails\x00"; array<Byte>^ msg = Encoding::ASCII->GetBytes(st); And when i convert back the array bytes to a string , i get a different string. System::String ^t = Encoding::ASCII->GetString(msg); MessageBox::Show(t,"asd"); The string t …

Member Avatar for saiaditya007
0
96
Member Avatar for blahblah619

I'm trying to get this countdown to work. I'm trying to get it to countdown from 10 down to "Blast off", with Blast off being 0. Each output replaces the one before it. I'm very confused. 10 does not print, but 9 to Blast off do. When when it Blast …

Member Avatar for siddhant3s
0
228
Member Avatar for jdm

I working on part of a code for a much larger project. I understand how to write a program for a password in the simplest form, but I want to have it let the user guess the password up to 5 times and then not let them run a command. …

Member Avatar for jdm
0
223
Member Avatar for nhamyl

[code]#include <stdio.h> #include <conio.h> int main(){ printf("*\n**\n***\n**\n*"); getch(); return 0; }[/code] i want help to write this program segment using loop statements to produce the following output * ** *** ** *

Member Avatar for siddhant3s
0
84
Member Avatar for defender_

i am working on c++ server client example using sockets.... whenever i tried to run server 2nd time on the same port it fails !! ok... i know that port is not free and still opened for my previous program but i have used [icode]SO_REUSEADDR[/icode] but still it's not working …

Member Avatar for jencas
0
1K
Member Avatar for Barbarrosa

Hello, I am currently attempting to write some code in Matlab which will allow me to output information to a USB port (which is changed into a PPM signal however this part is already accomplished by some hardware). I have an example of how to use the PCTx-PC to transmitter …

Member Avatar for Sky Diploma
0
173
Member Avatar for vs.vaidyanathan

What does error Lnk 2001 and LNK 1120 mean? Am a complete noob.. Could anyone please give me a step by step procedure to rectify it?

Member Avatar for vs.vaidyanathan
0
119

The End.