51,593 Topics
![]() | |
[CODE] 0: #include <iostream> 1: #include <string> 2: using namespace std; 3: 4: int main() { 5: int myIntArray[4] = {1, 2, 3, 4}; 6: double myDoubleArray[4] = {100, 101, 102, 103}; 7: 8: int i; 9: int *ip, *ibp; 10: double *dp, *dbp; 11: 12: ip = &myIntArray[0]; 13: … | |
Every time I run a makefile at work I get this warning from C++ : [code] cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++ [/code] does anyone know how to quiet it? We are compiling for ecos, cygwin and linux, with a combination of … | |
I got the first function tagReader to work, but how do I get the program to read the other functions such as getEmployee, paycheck, repeater, valid, and header. Here is all I get for the output: Results from tags1.txt : Cylinder: bsharkdata 1782 12.00 82.90 Cylinder: ftmyersfeb 7150 11.00 32.89 … | |
Hi, I'd like to add a GUI to one of my C++ codes. As the software should run under Linux and Windows I think about using QT. A special requirement is that I'd like to visualize 3D objects (triangular meshes). It should be possible to turn and zoom the objects, … | |
What is the semantics of the line "using namespace std;"? | |
Hi! Is it possible to read from specific row on a notepad? For Example: Jay Mark Christian I only want to display the word Christian which is on the third row, what will I do? can you please show me? Thanks! Here's my code: [CODE]#include <iostream.h> #include <iomanip.h> #include <fstream.h> … | |
This is my encyription and decyrption program. However there some mistakes that ı could not solve them. And ı set everything but when ı press q, my program should quit, ı tried some things but it is not appropriate for c++ rules. #include <iostream> using namespace std; void encyrpt(void); void … | |
Hey, i just start working with string and i am totally noob =). So i would like to ask you if you can help me... I have some programs to write, but i have a little problems to get the code working... Ok first question is, how do i make … ![]() | |
![]() | i have problem . how make a 100 random number series. i need a code. plz plz plz help me ![]() |
![]() | i make this progrm . first i generate this of 100 number . then user cheaked the user how many time number is repeated in this series. but i want random series of 100 number . please check it & how to create a random series in this program. [CODE] … ![]() |
ı could not solve non lvalue assignment problem in this example I thought for long time but ı could not find any answer if you can help me , ı would be very happy include <iostream> using namespace std; void encyrpt(void); void decyrpt(void); void menu(void) { char a; cout<<"(E/e) Encryption"<<endl; … | |
This is a singlylinked list code.This shows no error but while execution it shows singlylinkedlist.exe has encountered a problem and needs to close thanks in advance [code] #include "singlylinkedlist.h" #include <iostream> using namespace std; class singlylinkedlist //class for linkedlist { private: struct node //struct daclares the abstract data and link … | |
Alright guys, I'm in quite a situation. I have a project for school to create an application in C++ that can create and generate shopping dockets/receipts. This includes being able to add the names of the items, the prices, and then finding the total price of the purchase. We can … | |
I'm having trouble figuring out how to use exceptions to check if a file stream was created successfully. I know I can use if statements, but how do I do this using try/catch statements? It compiles successfully but it gives me an error when I supply a non-existent filename as … | |
class stinker { private: int *pointer; int age; public: stinker() : pointer(), age() { ;} }; if i don't pass a value to my variables in an initialization list, do they automatically get initialized to 0? | |
I recently wrote an implementation of STL Vector as a programming exercise. The program compiles but I receive a strange error saying: [CODE] terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc [/CODE] I've never come up with this error before and am not sure what exactly should be … | |
Hi, I have been working on this program for a few days.. and I am so far gone I lost myself in my own program. I usually just start from scratch when I get frustrated but there is too much time invested into my heap to give up so I … | |
I do not know how to write a function for this. I have written just the base line of the code, but I do not know how to finish it. Here is the description. A void Function tagReader inputs the data collected by the cylinders; it has two parameters: the … | |
Hi guys, I am trying to modify my program so that when i entered an invalid number, it will say that this is invalid and loop me back to the starting point. I just cant find the point to do that. either it will just say invalid and continues, or … | |
[code=c] int i=0,j=0; char operand[30]; char lbl[20],opr,num[20]; while(i<30) lbl[i]=num[i]=operand[i++]=NULL; cin>>operand; for(i=0; operand[i]!='+' || operand[i]!='-'; i++) lbl[i]=operand[i]; opr=operand[i++]; while(operand[i]!=NULL) num[j++]=operand[i++]; [/code] ..is there any mistake in this piece of code, my execution is getting stuck at [code=c] lbl[i]=operand[i]; [/code] | |
After running the following code segment, the output is Outer. Inner. Inner. [CODE] #include <iostream> using namespace std; namespace Outer { void message( ); namespace inner { void message( ); } } int main( ) { Outer::message( ); Outer::Inner::message( ); using namespace Outer; Inner::message( ); return 0; } namespace Outer … | |
May seem like a stupid question but can an array call a function? and if so is it possible to select an array from user input, so if the array was something like Num[10] and the user would input 6, it would then select Num[5] and call the function associated … | |
Hi I'm having a lot of trouble with this problem. Here is the assignment... Write the definition of the function template seqSearch to implement the sequential search on a vector object. [CODE] template<class elemType> int seqSearch(const vector<elemType> &list, const elemType& item); //If item is found in the list, return the … | |
I just reconstructed my new code and am having trouble. When I try to compile it I keep getting an error message. At the end of the program something is wrong, but I can't figure it out. [code]#include <iostream> #include <cmath> #include <string> using namespace std; int main () { … | |
Hi all, I've got quite a simple question and after searching here and on other websites I can't seem to resolve what the "correct way" of doing this is in C++. Below is a simple piece of code illustrating what I am trying to do: [CODE] #include <iostream> class BaseClass … | |
How would I create a simple loop so that the person using this program (user) can keep inputting weights until they want to quit. Also, I need trying to create a limit that the user can only enter in a certain range of numbers in the input. I want the … | |
<S> --> <A><B> <A> ---> a | b <B> ---> 1 | 1 <B> It's suppose to start will a or b and 1 afterward. it doesn't matter how many 1's are after a or b. [CODE]/* <S> --> <A><B> <A> ---> a | b <B> ---> 1 | 1 … | |
Hello and HELP!!!! I'm in CSC250. I'm writing a prog that needs to do the following: 1- read files from the directory, avoiding sub-directories (along w/ _chdir) 2- read the contents of the file (as binary) 3- extract info from the files 4- modify the file name to reflect info … | |
I'm not sure how to title the question I have so I can't be certain this hasn't been answered before. That said, following is a description of my programming question. I have a class R containing 2 integer elements, say X and Y. I then have two 24 element arrays … | |
Hi! I have a server which alows 5 clients to connect to it. I was wondering if it's possible to get their IP, or someother form of ID that sets them apart... I need it so I can assign names, and 'bannish' certain users. Thanks! | |
Hello, I've made a program that uses an array of objects, it's work well so far, upto the point that I try to increase the size of an array. So, in main the relevant code loops like this: [CODE]int main(){ /* classes used */ phoneBook *p; .... numLines = 0; … | |
im trying to make a program with win32 GUI and im having trouble getting this to compile. Here are the errors im getting [QUOTE]D:\Documents and Settings\Skull\Desktop\Dorzon\main.cpp||In function 'BOOL DialogProc(HWND__*, UINT, WPARAM, LPARAM)': | D:\Documents and Settings\Skull\Desktop\Dorzon\main.cpp|57|error: 'ShellExecute' was not declared in this scope| ||=== Build finished: 1 errors, 0 warnings … | |
I keep getting an error message when running my code at the end. I think it has something to do with line 26, but I'm not sure how to correct it. the error is sh: PAUSE: command not found My code is attached. Thanks for help in advance. [CODE]#include<iostream> #include<cmath> … | |
What is the difference between these two types of assingment? (a) [CODE]string color("red"); [/CODE] (b) [CODE]string color="red";[/CODE] | |
Could someone familiar with command line compiling using GNU C/C++ Compiler Collection please help me with a Dll creation problem I have? What I would like to know is how to create a Windows Dll out of the following very simple test file that is essentially just a "Hello, World!" … | |
I'm making a project with OpenCV about tracking. But what I want is the ability to let the user import his own tracking algorithms. Is there some way that i can check in a specified folder if there are new algorithms added and how can I include them in my … | |
I want to set precision to 2 with the results. Does that mean that I have to put << setprecision (2) << after every weight on each planet or is there something easier I can do? [code]#include<iostream> #include<cmath> using namespace std; int CheckWeight(int weight, string Planet); int main() { int … | |
Hello , i'm trying to solve a problem Tower of Hanoi recursively. I'm having problems with coming up with logic how to treat disks in terms of value. Lets say i have 3 disks how should i assign values to them ? My function is supposed to be defined such … | |
![]() | This is my computer science project,we were told to make any software we wish to make,so I thought about making a calculator,below is the code,but it doesn't seem to be functioning well,could anyone help and tell me what went wrong(I am using borland cpp 4.5 compiler,this program uses getch() to … ![]() |
I have tried several things, but I just can't work out how to do this, so perhaps someone could help me here. This is an example taken from [url]http://www.gnu.org/software/gsl/manual/html_node/ODE-Example-programs.html[/url] on how to carry out integrals. [CODE] #include <stdio.h> #include <gsl/gsl_errno.h> #include <gsl/gsl_matrix.h> #include <gsl/gsl_odeiv.h> int func (double t, const double … | |
my switch statement is not working properly. it works fine till case 'C', after that nothing is happening. Any ideas? [CODE]void processData(List<Movies>& myList, Stack<Movies>& myStack, Queue<Movies>& myQ){ Movies movieObj; int numInStack = 0, numInQ = 0, num2process = 0; fstream inFile("newReturns.txt"); if(!inFile){ cout << "Unable to open Returns.txt." << endl; … | |
Hi, I'm new here and also new in programming. I have a home assigment to make a c++ program which calculates the difference between two dates in days. (present - dateOfBirth). I don't think I'm allowed to use functions already implemented in c++, but my own. I've found many examples … | |
Any one would help me out to develop a code for a program to convert number from any base to any base..? | |
What is the difference between Structure and Class? Is there are any particular situations when I should use what? Once I implemented Binary search tree using structure. Now, I am trying to implement Red black tree using Class? But many discourages using class in this kind of situation, they say … | |
I have made a header file for SDL GUI applications. I was testing the SDLGame::Draw() function when I got a SigSegV fault. The fault occurs in different locations each time I run the program. Also sometimes instead of a SigSegV fault I get a SigTrap fault. Here is the code … | |
Hi, I'm wondering what which IDEs people use to develop C++ with. I am learning c++ from a background in Java, I am used to eclipse and recently installed Visual Studio. Now, eclipse comes with loads of auto-complete stuff. For example If i write a function and it doesn't exist … | |
Hello Everyone, I have a random number game program that I need to change to use a Class with a constructor. This is my first attempt at using these things, and the instructor hasn't been much help. I watched all of antiRTFM's videos up to video #37, but using constructors … | |
Hi...I need to write dynamic menu... which will take all items from ini/cfg gile cfg file will look like that: [CODE] TEMPLATE_NAME=LEX UPDATE PL=Czesc to jest update. ENG=Hi this is uptade. TEMPLATE_NAME=WINDOWS ERROR PL=Blad ENG=Error! . etc . . [/CODE] Items will be read to dropdown menu called TEMPLATES.. I … | |
Hello, I'm trying to open a URL wit the default browser in C++ using ShellExecute(), however I'm unable to do this, even using the example into the mocrosoft site. I'm not sure about what I'm missing. I have: [CODE] #include <windows.h> ... private: System::Void Go_home_LinkClicked(System::Object^ sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs^ e) { ShellExecute(NULL, … |
The End.