49,761 Topics
| |
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... :) … | |
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 … | |
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) … | |
| |
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( … | |
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 | |
[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 | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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. … | |
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() << ")" << … | |
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 … | |
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. … | |
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 … | |
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 … | |
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> … | |
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 … | |
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> … | |
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 … | |
i want to run some .exe in pocket pc using c++. how do i do that? thanks | |
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 … | |
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 … | |
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. … | |
[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 * ** *** ** * | |
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 … | |
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 … | |
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? |
The End.