51,593 Topics

Member Avatar for
Member Avatar for angelsakura

Hi, we have this school activity that is rush for tonight. I would really appreciate if somebody will help me. It would really mean a lot to me. So here is the problem that were tasked to us to create a C++ program. Problem: Write a C++ program to perform …

Member Avatar for WaltP
0
2K
Member Avatar for babis87

Hello! I am making a program which does many computations for a Photovoltaic system. The problem is that i get a strange segmentation fault error when I run the program. Here is where it crushes (at for-loop of calculation S5) : [CODE] commands..... ... ... /******************** WIRING *******************************/ Ni = …

Member Avatar for Salem
0
2K
Member Avatar for ahmed30

hello i just have started learning c++ but i have a big problem at sources .. i want to make something is unsigned then i have to change it from int3t_t to unit64_t but when i change it at player.h it says it must be changed at creature.cpp and alot …

Member Avatar for ahmed30
0
120
Member Avatar for confused!

Hello. I am trying to write a program where a human can play rock, paper, scissors with the computer. I'm stuck on the "determine computers choice" part......Here's my code so far... [code=cpp] #include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main () { // initialize the computer's random …

Member Avatar for wizzard_tzie
0
656
Member Avatar for bimoweemo

this is a piece of my header file that is a template and my implementtion file that is using it.I keep getting errors and dont know why,any help would be appreciated. [CODE]template<class T> class List { public: private: T *list; int size; int numElements; bool isValid(int location) const; }; [/CODE] …

Member Avatar for mike_2000_17
0
204
Member Avatar for sadsdw

Hi there, I need to read a file with unknown number of columns and lines. Basically, I have an ID per line (ID00005) and many columns containing 2 letters. The format is: ID00005 RR WW SS QQ TT RR UU II ID00008 WW SS QQ YY HH JJ KK LL …

Member Avatar for sadsdw
0
507
Member Avatar for oltokom

I recently started visual studio 2010.After searching in google I was able to create a .cpp program. everything is fine; I can build it and run it without getting errors.But everywhere in the internet I see when they run the program they can see a black command prompt window which …

Member Avatar for oltokom
0
326
Member Avatar for MareoRaft

This function is returning the error "matrixOpsLibrary.h:11: error: invalid initialization of reference of type ‘const std::Vec&’ from expression of type ‘const double’" [CODE]#include <vector> #include <cmath> using namespace std; typedef std::vector<double> Vec; //Vector Vec floor( const Vec& y ){ unsigned n = y.size(); Vec bottom(n); for( unsigned e=0; e<n; ++e …

Member Avatar for MareoRaft
0
195
Member Avatar for jepapel

I was wondering if there is a library or smt that can allow a programmer to use other foreign languages in C++. For instance i want my c++ program to display some Greek messages that i will define, but instead i get some garbage. Is there anyway to call unicodes …

Member Avatar for Plato_1981
0
3K
Member Avatar for mrnobody

Hi, How do I correctly call a function which expect BSTR* as a parameter? eg: [CODE]void FunctionA(BSTR* b) { // Do something }[/CODE] Currently, my code is as follow: [CODE]void Caller() { BSTR* pbstr; FunctionA(pbstr); }[/CODE] However, during compilation, I get warning "local variable pbstr' used without having been initialized". …

Member Avatar for Ancient Dragon
0
214
Member Avatar for RAIMI

hi i compile this code but it works but i have as result the error message "Memory is insufficient! " [CODE] #include <iostream> #include <iomanip> #include <fstream> #include <string> #include <math.h> #include <nurbsS.h> #include <nurbsSub.h> using namespace std; int i ,j , l , k ,x,y ; float b; const …

Member Avatar for RAIMI
0
113
Member Avatar for loumbut

I wrote the following code to create a wav file which generates varying frequencies based on the Hebrew Gematria pattern. It compiles great but does not write the wav file. What am I not understanding about this code? [CODE] #include <iostream> #include <math.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include …

Member Avatar for ivanx_wu
0
2K
Member Avatar for kumarmpk4u

Hi All, When my code tries to free the memory allocated by the new operator it throws a debug error while using the delete operator... [CODE] CDocum* pDocum = new CDocum(); int nResult = pDocum -> QuoteDocProd(); delete pDocum; [/CODE] Error Am getting is Debug Error! Damage after Normal Block(#298753) …

Member Avatar for kumarmpk4u
0
411
Member Avatar for RAIMI

Hi! I try to compile this code [CODE] while( file >> word) { word.size(); T[i]= new string[word.size()]; *(T[i])= word; i=i+1; } for (j=0;j<i;j++) { Bt[j] = new float [100]; *Bt[j] = *atof(*(T[j]).c_str()); } [/CODE] but i have this problem [CODE] error C2228: left of '.c_str' must have class/struct/union [/CODE] where …

Member Avatar for RAIMI
0
807
Member Avatar for anoopvadi

hi, am a novice in programming. i am facing some difficulty in C++ programming, actually i want to read a column of numbers from a text file or an excel sheet and store that in an array so that i can use it for further processing.Plz help me to solve …

Member Avatar for tikoti
0
3K
Member Avatar for kalingaRHASTA
Member Avatar for L0s3r

Code 1: [code]#include<iostream> using namespace std; int& func() { int a=6; return a; } int main(void) { int a = func(); cout<<a; cin.get(); return 0; } [/code] According to my thought , first of all func() will create a temporary reference to a (as it is returning by reference) , …

Member Avatar for arkoenig
0
93
Member Avatar for L3gacy

Hello everyone, I have a small question about the code below, I understand just about every part of it. Except for this small snippet, could someone explain how the loop works? [CODE] while(begin != end ) //<-- I believe the stream iterator is getting input here words[*begin++]++; // <-- I …

Member Avatar for mrnutty
0
324
Member Avatar for bimoweemo

I keep getting errors and i dont know what im doing wrong.I've included just pieces of these three files. The compiler is giving me errors and i dont know what's wrong. this is my header file List.h not all but some of it. [CODE]#include <iostream> using namespace std; #ifndef INTEGERLIST_H …

Member Avatar for NathanOliver
0
207
Member Avatar for xxlt3xx

Hi, I'm stuck... I'm writing a program that creates a data file then populates the file with 500 random integers both positive and negative. The problem I'm having is reading the integers from the file and storing them into three arrays for processing neg[],posEven[],and posOdd[]. I really just need a …

Member Avatar for xxlt3xx
0
172
Member Avatar for SandraM

Hi! I´m newbie in C++ Code and JNI, so i have a big problem and i can´t found a solution. My question is: Is possible to call a Jni method in a normal ,method, so: I have in my c++ class, two method: void CVentanasDlg::OnButtonStart(){ printf("OnButtonStart"); } JNIEXPORT void JNICALL …

Member Avatar for SandraM
0
108
Member Avatar for MareoRaft

What happens when you set an int or double value to less than the minimum? I need my program to recognize when a number is smaller then the minimum, and then set the value to equal the minimum instead. This behavior is not the default... [CODE]#include <iostream> using namespace std; …

Member Avatar for mrnutty
0
136
Member Avatar for apanimesh061

I do not know how to compile a visual C++ project using makefile ! I am trying to build a boot loader using C++ and assembly. This is the list if the constituent files in the project: start.asm //this is the beginning bootMain.cpp //main function displayScreen.cpp //clears th screen buffer …

0
58
Member Avatar for jas2010

hi all friend I wanna Read some data from my Excel , but I can't work excel 2007, do you know what's problem.

Member Avatar for jas2010
0
297
Member Avatar for RAIMI

hi i want to change the static table to a dynamic table using pointer what should i change in this case ? [CODE] #include <iostream> #include <fstream> #include <string> #include <math.h> using namespace std; int i ,j , l , k ,x ; float b; const int maxElements = 10000; …

Member Avatar for Narue
0
582
Member Avatar for RAIMI

I was trying to write a program . But when i run it i have this error message this application has requested the runtime to terminate it in an unusual way

Member Avatar for RAIMI
0
309
Member Avatar for vinothcv

write a program that can be used to assign and book seats for a commercial cinema. The cinema has 16 rows, with 20 seats in each row. The seats at the mid-column (number 5 to 15) of the last 2 rows closest to the doors (row A and B) are …

Member Avatar for Salem
-1
518
Member Avatar for salah_saleh

I was reading a book and i faced an issue here [CODE]39 template< typename NODETYPE > 40 void Tree< NODETYPE >::insertNode( const NODETYPE &value ) 41 { 42 insertNodeHelper( &rootPtr, value ); 43 } // end function insertNode 44 45 // utility function called by insertNode; receives a pointer 46 …

Member Avatar for salah_saleh
0
156
Member Avatar for rayden150

I tried to store several data an cant achieve it: [CODE] #include <iostream> #include <string.h> #include <stdlib.h.> #include <stdio.h> #include "estructura.h" void guardar_cliente(cliente x) { FILE*f; f= fopen("data.txt", "w"); fwrite(&x, sizeof(x), 1, f); fclose(f); } [/CODE] I dont know whats wrong im using another cpp file and a header file …

Member Avatar for mike_2000_17
0
256
Member Avatar for bimoweemo

If i had to write a program with 10 different functions are you aloud to just make some functions templates and other functions initialized with data types like normal???

Member Avatar for bimoweemo
0
117
Member Avatar for massivefermion

I think its more than a year that I ask my questions about programming in this forum.Looks like its the time that I help a little too. So I wanna put my best here.I hope it'll help some one. Still I'll appreciate any suggestion. Another point,It was my first time …

Member Avatar for massivefermion
0
476
Member Avatar for MareoRaft

I want two function names that do the same thing, allowing the user to use whichever they prefer. For Vec a, i use "const" because a is never changed. Correct me if this is the wrong usage. For int n in operator|, i do NOT use "const" because n is …

Member Avatar for mike_2000_17
0
302
Member Avatar for madriceg

I am trying to use CString's LoadString function but it never retrieves the text from the string table. I ported the application from Visual Studio 6 to visual studio 2003. I looked all over the web but nothing is working. Somebody help me! And if you could be very specific. …

Member Avatar for madriceg
0
2K
Member Avatar for MareoRaft

I was advised that I should not import the std namespace in a header. Also, I should create my own namespace for my library (a header file I created with function in it). Why is it a bad idea to use the std namespace for my new functions? If all …

Member Avatar for mrnutty
0
151
Member Avatar for ahsanm45

Hi I am New to MFC actually i want to know that how to open New Window/ New Form From Main WIndow. Please Help me in that Thanks.

0
58
Member Avatar for MareoRaft

There is an error concerning lines 10-14. I had been using this code previously without errors. I'm not sure what I may have changed. The error is "invertMatrix.cpp:14: error: invalid use of incomplete type ‘struct std::stringstream’ /usr/include/c++/4.2.1/iosfwd:83: error: declaration of ‘struct std::stringstream’ " [CODE]#include <iostream> #include <vector> #include <cmath> using …

Member Avatar for mrnutty
0
2K
Member Avatar for bigdan182

I am writing some code to simulate a football tournament by comparing several teams on several parameters. I need to be able to knock out teams, edit some stats mid simulation, and be able to easily access individual teams data, what structure would I be best using? I had thought …

Member Avatar for mike_2000_17
0
221
Member Avatar for dark_sider_1

Hi there, I'm trying to teach a few students how to create a text adventure game. In the past, I've generally gone about the route of using nested if-statements because it seems a bit easier to visualize. Here's what one has done in the past, and ignore the crazy code-formatting …

Member Avatar for dark_sider_1
0
219
Member Avatar for ztdep

Dear friends: I use the find algorithm in STL to find a term in the vector<string>, but the find only return the iterator, how to return the index number of the term. Regards

Member Avatar for Insensus
0
70
Member Avatar for Jsplinter

I want to iterate through a list of objects, then erase all objects from the list which meet a certain criteria. Here is an example using int type as my object: [CODE] list<int> m_list; // Fill list with int values... // Find ints == 4 and erase them auto it …

Member Avatar for Narue
0
233
Member Avatar for tikoti

Hi all! I have a little problem here, I would like the width function in cout applied to all the sucesive outputs. However, it is only applied to the next output only, I mean, with this code I get 0:00:10:20:30:4 1:01:11:21:31:4 2:02:12:22:32:4 3:03:13:23:33:4 4:04:14:24:34:4 5:05:15:25:35:4 6:06:16:26:36:4 7:07:17:27:37:4 8:08:18:28:38:4 9:09:19:29:39:4 and …

Member Avatar for tikoti
0
2K
Member Avatar for Mona Ali

its my code pleas tell me y error occur in it. impex.h file [CODE]#ifndef IMPEX1_H #define IMPEX1_H enum shapetype {Point=1,Polyline=3,Polygon=5}; struct pointD { double x; double y; }; struct item { int id; list<pointD>coordinates; shapetype type; }; class impex { public: impex(); void savekml(list<item>); private: }; #endif .cpp file #include<iostream.h> …

Member Avatar for Mona Ali
0
210
Member Avatar for shadowscape

Hello, i was wondering how you would create a file association in c++ with the registry, in lua it would be something like this... [CODE] function File.SetAssociation(Ext, Exe, Icon, Long) local cKey = Long; Registry.SetValue(HKEY_CLASSES_ROOT, Ext, "", Key); Registry.SetValue(HKEY_CLASSES_ROOT, Key, "", Long); Registry.SetValue(HKEY_CLASSES_ROOT, Key.."\\DefaultIcon","",Icon..",0"); Registry.SetValue(HKEY_CLASSES_ROOT, Key.."\\shell\\open\\command", "", "\""..Exe.."\" \"%1\""); end …

Member Avatar for shadowscape
0
166
Member Avatar for SoSlow

.the program should use singly linked list of records.It should print he original directory then make some insertion and deletions then print the final directory. it should follow the steps 1. input initial listings such as name, address, and phone number. 2. input update records such as 'I' for insert, …

Member Avatar for Salem
0
353
Member Avatar for DotNetUser

I launch 2 programs within my application with PROGRAMNAME->Show. Let's call them Prog1 and Prog2. I have a dummy form that I use Application::Run to keep the software running. When 1 of the program closes, I call Application::Exit to shut down the application. This doesn't allow the other program to …

Member Avatar for pixma
0
224
Member Avatar for mark_6

i need a code for this!! Z asterisk pattern!! plsssssssss The program forms the letter Z by printing n input character symbols on the upper line, n input character symbols on the lower line, and n input character symbols on the diagonal line. If the value of n is less …

Member Avatar for sumant mahadik
-1
1K
Member Avatar for Joemeister

I'm new to C++ and here's a simple assignment. I'm not sure how to pull this off... ANY help will be appreciated . Here's the code for the assignment... You have to implement a function called approachPi that takes no parameters, and has the return type double. This function returns …

Member Avatar for Tellalca
0
185
Member Avatar for newbee234

Which of the following are valid function prototypes? x one(int a, int b); int thisone(char x); char another(int a, b); double yetanother; void thelastone(); void (function1) void; void function2(void) void function3(n, x, a, b); x void finction4(int n, float, char c); x void function5(int, a, int n); Which of the …

Member Avatar for NathanOliver
0
219
Member Avatar for daviddoria

I typically make a Types.h to define all of my types in and then include that in all of my project files. I haven't ever seen this anywhere though, so I assume it is "bad/wrong". The situation is often like this: Consider a class Gardener that needs to know type …

Member Avatar for mike_2000_17
0
134
Member Avatar for dyingatmidnight

Hello, I have been tasked with writing a test application to convert between geographic coordinate systems. Now math is not my strong suit but I was assured I wouldn't actually have to do any of the calculations since the formulas are provided. The trouble is trying to get the lengthy …

Member Avatar for dyingatmidnight
0
2K

The End.