49,761 Topics

Member Avatar for
Member Avatar for dirbax

Hi , is it possible to transform the following code to math [code=cplusplus] int F( int n ) { int r=0; int mid=n/2; for( int i=0 ; i<n ; i++) { if( i<mid) r+=1 ; if( i==mid) r*=2 ; if( i>mid) r=pow(r,3) ; } return r ; } [/code] and …

Member Avatar for Rashakil Fol
0
120
Member Avatar for cppnewb

Hi. I have a program that goes a little like this: [CODE] // Include files, etc... int main() //code... [COLOR="Green"] if (input == "logout"); { return main(); } [/COLOR] // rest of the code [/CODE] Now, every time the program goes to main, the values previously stored in the varibles …

Member Avatar for nucleon
0
126
Member Avatar for MentallyIll5150

How do I pass this function if int &pos(void) - returns the element at "position" by reference my method in class definition: int &pos(void): my function is [code] int dequeint::&pos(void) { return CurrPos->x; } NodeValueType dequeint::front() { return headi->x; } [/code] but i get this compiler error expected unqualified-id before …

Member Avatar for Narue
0
94
Member Avatar for winrawr

Well, I don't know if this is what you would call an anonymous function, or "Lambda" function I guess, I haven't really gotten that far into languages that use them yet... but, I am writing a function that is rather long. And I want to just get through it, and …

Member Avatar for winrawr
0
88
Member Avatar for peacerosetx

Greeting all, Peace. I had this error [QUOTE] error C2059: syntax error : ')' [/QUOTE] in VS with c++ code, and searched the web and forums for a solution but could not find one. Finally I simply typed in the bracket ")" in the "find key" to search for all …

Member Avatar for peacerosetx
0
521
Member Avatar for ward.605

I am trying to sort an array and eventually get the 'n' closest numbers to the position the user chooses but i can't get the sort function to work first. Here's the code: #include <iostream> //for standard I/O #include <iomanip> //for setw(), etc. #include <cstdlib> //for rand(), srand() #include <ctime> …

Member Avatar for vmanes
0
88
Member Avatar for wrxhokie

I have a name mangling issue with a C++ static library that was created using VS 6.0. I'm trying to write a wrapper DLL using this static library, but i'm having trouble accessing the functions of this library due to name mangling. My compiler (VS 2005) shows this for a …

Member Avatar for Ancient Dragon
0
196
Member Avatar for jesse_johnson2

[CODE]//Tic-Tac-Toe #include <iostream> #include <iomanip> using namespace std; const char COL = 3, ROW = 3; typedef int tttb[ROW][COL]; //tttb tic-tac-toe board bool winner(tttb, int,bool); //funtion name winner bool move(bool); int main() { bool isWinner; isWinner = false; cout<<"isWinner= "<<isWinner<<endl; isWinner = move(isWinner); cout<<"isWinner= "<<isWinner<<endl; if (isWinner = true) { …

Member Avatar for jesse_johnson2
0
90
Member Avatar for arshad115

i m making a hotel database management system and i have to add records, update and delete them.i m having problem in getting the input,how will i use double pointers?? and i have to get a certain number of records from the user. here is my code: [CODE] void addcustomer() …

Member Avatar for tux4life
0
2K
Member Avatar for DemonGal711

Ok, apparently my destructor isn't done yet and I'm not sure how to handle this. I have an n-ary tree that contains nodes that are built of data and a vector of pointers. Each pointer was initialized with new, so I need to delete them obviously. One friend said I …

Member Avatar for ArkM
0
1K
Member Avatar for cppStudent

I'm trying to write a stack implementation that makes use of a single link list. The new Stack implementation can inherit from stackADT which I previously used with an array opposed to the link list I want to make use of now. Here is the stackADT [CODE]#include "StackADT.h" StackADT::StackADT() : …

Member Avatar for jencas
0
105
Member Avatar for Fouly

Hi, I'm trying to count files in a desired directory using MFC... I tried the following code: [code] int CountFiles(const std::string &refcstrRootDirectory, const std::string &refcstrExtension, bool bSubdirectories = true) { int iCount = 0; std::string strFilePath; // Filepath std::string strPattern; // Pattern //std::string strExtension; // Extension HANDLE hFile; // Handle …

Member Avatar for Fouly
0
258
Member Avatar for beto_best

People, someone knows if there is a client/server chat for mac os x ? i need the source code pleaseee !!! in c ++

Member Avatar for Ancient Dragon
0
44
Member Avatar for abby2589

can someone tell me whats wrong with this codes, because there's some error in printing.. [CODE]#include<stdio.h> #include<iostream.h> struct bday{ char month[2]; char date[2]; char year[4]; }; struct contacts{ char surname[10]; char phoneno[12]; }; void main(void) { struct contacts con[2]; struct bday bd[2]; int i; for(i=0;i<=2;i++) { cout<<"\nSurname : "; cin>>con[i].surname; …

Member Avatar for Ancient Dragon
0
86
Member Avatar for ScienceNerd

I just started studying structured programming and I was trying to do a If Else then function but the compiler won't let me compile it? #include <iostream> using namespace std; int main (void) { int age; cout << "Enter your age" << end1; cin >> age; if(age > 21) { …

Member Avatar for charleen
0
112
Member Avatar for hansel13

I need to create a search function that search for a product type. If it's found, I return true, otherwise i return false. My client program will output the data that was found (if true), otherwise it'll output an error message saying that product type does not exist in the …

Member Avatar for DemonGal711
0
138
Member Avatar for riahc3

Hey In VS, you can in a struct do: [code] struct test{ int tes; }tt; [/code] then when I put tt., it would display the all fields in a tooltip which in this case would display tes. Is "IntelliSense" (I know it is not called that) in wxDev-C++?

Member Avatar for mitrmkar
0
119
Member Avatar for walom

I'm trying to convert a string to an integer and store it in the same variable multiple time through a loop. For some reason it never works after the first time, it screws the number up. [code] #include <stdlib.h> #include <string> #include <iostream> #include <cstdio> #include <sstream> using namespace std; …

Member Avatar for siddhant3s
0
70
Member Avatar for DemonGal711

I'm dealing with a map of vectors, and I'm making sure I clean up all the memory used. So, what exactly is the best way to handle this? One person said to use clear() on each vector in the map and then use clear() on the map, but I don't …

Member Avatar for DemonGal711
0
88
Member Avatar for Icebone1000

Hi, I alredy got it to work, but I did things that I figured out by debugging it, and I dont understand very well what is happening.. So..I trying to read a file header( its a ppm image file), here is a commom one: [CODE] P3 # example comment 512 …

Member Avatar for Icebone1000
0
96
Member Avatar for ahfan_85

I have a question here: Complete a program that performs following operations by using C++ programming: a.Enable user to create and manipulate a list of items (must be able to read integers, characters and strings). b.Enable user to sort the list. (any sorting algorithm except naïve sort) c.Enable user to …

Member Avatar for ahfan_85
0
123
Member Avatar for Duki

Hey guys, I have a function that compares two dynamic arrays and returns true or false if they're identical. [code=c++] bool Identical(QueType que1, QueType que2) { if (que1.IsEmpty() != true && que2.IsEmpty() != true) { cout << "in loop\n" ; ItemType tmp1 ; ItemType tmp2 ; que1.Dequeue(tmp1) ; que2.Dequeue(tmp2) ; …

Member Avatar for Duki
0
177
Member Avatar for arshad115

i m getting a runtime error and the program skips the first attribut i.e name,and gives a runtime error at the second one.compiler gives some warning about gets".\Assignment 3_Question 4.cpp(118) : warning C4996: 'gets': This function or variable may be unsafe. Consider using gets_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. …

Member Avatar for vmanes
0
152
Member Avatar for arshad115

i m having so many problems,i m trying to make an hotel database management program in win32 console and i m not allowed to use structures,only variables or pointer or Dynmaic arryas. i m using 2d dynamic array,i have to pass it to a function to store values in it,i …

Member Avatar for vmanes
0
168
Member Avatar for JameB

How do you find the length of an int array?? I have int array with some values and I need to count how many values are there? I tried a lot of things like strlen(); sizeof(); etc.. [code=c++] int main() { int iarray[10000]; // Now I have a lot of …

Member Avatar for arshad115
0
156
Member Avatar for CPPRULZ

Hello, I posted a program about converting furlongs to kilometers and other conversions concerning those 2 main units. These errors kept popping up: error C2027: use of undefined type 'Kilometer' see declaration of 'Kilometer' error C2228: left of '.getkilometers' must have class/struct/union error C2027: use of undefined type 'Kilometer' see …

Member Avatar for CPPRULZ
0
153
Member Avatar for CPPRULZ

Hello, I have been working a week on this program with this stupid bug that gives tons of errors. I have narrowed them down to 4 errors and 2 warnings but I have no idea how to fix the 4 errors. The program is supposed to have two user defined …

Member Avatar for siddhant3s
0
114
Member Avatar for cruisx

Hi guys, i am working on a bank program for school but i am running in to a small problem. when the program starts up its displays a menu such as: item 1 item 2 item 3 And say if you click item 2, it will do waht ever it …

Member Avatar for charleen
0
87
Member Avatar for aminura

Well, today I had my C++ viva at my school..and I screwed it up!! The answers to this question which I was asked may be easy but I couldn't get it..Few questions of which I haven't got the answers yet-- 1. [CODE]class A { public: int a; int b; };[/CODE] …

Member Avatar for charleen
0
282
Member Avatar for robotnixon

Quick question (hopefully). I have a vector of strings and need to remove duplicates. Normally, I'd just use sort, erase and unique. However, I don't want to sort the data. My idea was to copy the vector to a set, then back to a vector. But every attempt just screws …

Member Avatar for robotnixon
0
498

The End.