49,766 Topics

Member Avatar for
Member Avatar for ayesh.yousaf

i have to write a code that should count spaces. i am writting in this way but its not working. if (input==' ') space++;

Member Avatar for nullptr
0
93
Member Avatar for maybnxtseasn

How do i alter an element in the set for example how do i edit the 'm_a' member variable of a element in my set? class CPerson { public: int m_a; CPerson(int _a) { m_a = _a; } } set<CPerson*> myPersonSet; .. ... set<CPerson*>::iterator it = myPersonSet.find( CPerson(20) ); // …

Member Avatar for rstralberg
0
157
Member Avatar for Hojjat.Mojallal

Hi I've tried the code below to merge 2 linked list which f1 and f2 are the first nodes in the initial lists and the "first" is the first node in the result list. But it doesn't work! [CODE] node *merge(node *first,node *f1, node *f2,int n1,int n2){ int n=n1+n2; while(n-- …

Member Avatar for mandeepsukhwinderparmar
0
4K
Member Avatar for dancks

I don't know jack about Visual Studio, and I'd like to keep it that way because I like doing stuff on the command line, I have my preferences. But my teacher uses it to compile and I'm curious what I did wrong because gcc didn't throw anything. So, code (Without …

Member Avatar for dancks
0
201
Member Avatar for jongiambi

Hi so I have a practice lab I am working on where I am asked to fill in the code. The program is supposed to take in two 3D points (x,y,z) and compute the distance between them. I have almosty all of the program finished im just stuck on how …

Member Avatar for rubberman
0
867
Member Avatar for djbsabkcb

Below is my code for Fibonacci sequence, however when I use a large number such as 100 or more it takes forever to produce output. Why? any help would be appreciated. :( [code]#include <iostream> using namespace std; long fib_num ( long ); int main() { long num = 0; long …

Member Avatar for josh2k12
0
2K
Member Avatar for jghost

Ok this is the classic Towers of Hanoi question. Legend has it that in a temple in the Far East, priest are attempting to move a stack of disks from one peg to another. The initial stack had 64 disks threaded onto one peg and arranged from bottom to top …

Member Avatar for angelbellz
0
2K
Member Avatar for karmmi

Hi all I need to return four dimensional array of strings during the work of background worker which is receiving data via serial port. In background worker: array<String^>^ Received = gcnew array<String^>(4); BackgroundWorker1->ReportProgress(10,Received); In report progress: private: System::Void backgroundWorker1_ProgressChanged(System::Object^ sender, System::ComponentModel::ProgressChangedEventArgs^ e) { array<String^>^ Received2 = gcnew array<String^>(4); Received2 =(e->UserState); …

Member Avatar for Ancient Dragon
0
152
Member Avatar for s_danielsz

(Before I ask my question, I have tried looking through google and the site already, and didn't find anything relevant to what my problem was. All I was finding was more complex than my current level.) Anyway, my problem is that I'm getting an "expression must have (pointer-to-) function type …

Member Avatar for Ancient Dragon
0
666
Member Avatar for itla

I am not grasping C++ very well and I am having a hard time with this assignment: • Write a program that does the following: Calculates the Velocity and Momentum of an object. The formula for the velocity is V=d/t and the formula Momentum is m=mass*velocity. Your program should consist …

Member Avatar for itla
0
277
Member Avatar for owenransen

I'm obviously typing in the wrong search terms, but I'm looking for a REST application in C# in Web API running on Azure, but with an example of calling that REST C# from a VS2010 C++ application. I have one half (the C# bit) but I can't find any examples …

Member Avatar for owenransen
0
161
Member Avatar for RounaqJJW

Getting the error LNK2019, eb=everything included Desparate, pls help!!!!!! 1>------ Rebuild All started: Project: ConsoleApplication1, Configuration: Debug Win32 ------ 1> stdafx.cpp 1> ConsoleApplication1.cpp 1>ConsoleApplication1.obj : error LNK2019: unresolved external symbol "void __cdecl mod_rec(void)" (?mod_rec@@YAXXZ) referenced in function "void __cdecl menu(void)" (?menu@@YAXXZ) 1>ConsoleApplication1.obj : error LNK2019: unresolved external symbol "void __cdecl …

Member Avatar for rstralberg
0
209
Member Avatar for evantage

I am having trouble copying projects, I am using allegro 5 on my course at the moment so it makes completing the exercises faster by creating a default allegro project which has been modified to contain the allegro libraries and such and using this to create new exercises. The way …

Member Avatar for markaburlingame
0
171
Member Avatar for daino

Would anyone know what the PNG Include directory variable should be for CMAKE. I can't seem to find a Cmake module to search for PNG in the program which depends on LIBPNG (unlike all it's other dependencies). I've been using PNG_INCLUDE_DIR but CMAKE doesn't seem to recognise it? thanks.

Member Avatar for daino
0
9K
Member Avatar for bdl365

i need to write a program that ouputs any five positive integers to the screen? for (int i = 1; i <= 5; i++) cout << rand () // what goes here? usually when there's a range (lets say any 3 digit number) i usually do it like this cout …

Member Avatar for markaburlingame
0
87
Member Avatar for mtm6042

I am having trouble finishing this code for an assignment i have due. I have to create a code that (depending on what the user picks) sorts the numbers in ascending or decending order using an array with the funcion in the code. Any help would be greatly appriciated. #include …

Member Avatar for markaburlingame
0
156
Member Avatar for stephaniec

Please help me with following problem (I am struggling in a class that I really shouldn't have taken, and I have absolutely no idea where to start, or how to continue with it): Write a program that can be used to assign seats for a commercial airplane. The airplane has …

Member Avatar for Ancient Dragon
0
346
Member Avatar for Seni0RRunn3r

What's up guys? I have this question....I'm trying to extract a number from a stream after I extract a charachter but after charachter it displays ASCII value, not the actual number: cin >> ch; num1 = cin.peek(); cin.ignore(80, '\n'); cout << ch << num1;

Member Avatar for Seni0RRunn3r
0
2K
Member Avatar for Magda6347

I've been trying to do this asteriks triangle with nested loop for days and many hours and still no luck. Im using visual studio 2010 and I've been searching the web for clues and everytime I use the cout, anything iostream, const char and more it always fails I'm not …

Member Avatar for Ancient Dragon
0
236
Member Avatar for Enders_Game

Pretty self explanatory code. Why doesn't it work! #include <stdio.h> int main() { __asm__("number dw 0"); // declare number? printf("%d",number); __asm__("mov %eax,number" "inc %eax" "mov number,%eax"); printf("%d",number); return 0; } cc ex1.c -o ex1 ex1.c: In function ‘main’: ex1.c:22:17: error: ‘number’ undeclared (first use in this function) ex1.c:22:17: note: each …

Member Avatar for Enders_Game
0
289
Member Avatar for vishalonne

Hi Everybody I am trying to create a template class here is the code I trying to just add and multiply 2 number. But I am not able to do so using template class. class calc { public: template <class T> T multiply(T x, T y); T add(T x, T …

Member Avatar for mike_2000_17
0
211
Member Avatar for abhishekbalaji

I am just beginning to learn pointers and I have a question regarding accessing the values using the address. Suppose we have an array of say 10 elements and I begin to access all the elements starting from the 10th element, and go on untill i access the 0th element... …

Member Avatar for MandrewP
0
129
Member Avatar for pbracing33b

I have a program that is suppose to find the percentage of occupied rooms in the hotel. I have most of my program running, but when I try to typecast my percentage the percentage isn't coming out right and I am not sure as to why. I have set a …

Member Avatar for Ancient Dragon
0
110
Member Avatar for ranam

hi , i have a 3 columns with content and can be sorted and now i want a small symbol on them when that column is sorted like if column one is sorted then the symbol should be on 1 similarly for rest, And thank you very much for ancient …

Member Avatar for Ancient Dragon
0
133
Member Avatar for liphoso

How would i go about declaring an array that has pointer to linked lists? i need to create an array that has 28 elements(28 letters of the English alphabet) of char type and each of them should be a pointer to a linked list that will store words. i am …

Member Avatar for Ancient Dragon
0
186
Member Avatar for triumphost

Ok I know the difference between delete and delete[] BUT this question just all of a sudden popped in my head since "NOTHING" happens when I use delete[] for all purposes. Now I know when to use one or the other but it still for some odd reason bothers me …

Member Avatar for mitrmkar
0
175
Member Avatar for daino

How do I set the CMAKE_INCLUDE_PATH? Also... How to I set the CMAKE_LIBRARY_PATH? All i know about CMAKE is that is is a GUI with very limited options. Where do I put these variables and why do I set them? How do I set them? Thanks

Member Avatar for daino
0
11K
Member Avatar for Hopp3r

Ok, so I've recently been learning to code in c++, but I'm getting a little confused on how you read files to functions. For instance, say that I have one file with a list of other files in it. The information within the second set of files (each file) contains …

Member Avatar for triumphost
0
3K
Member Avatar for pepsi123

I'm struggling with C++, especially when it's about sorted list. Do they work like arrays? This is what I'm trying to do: 1. Student applicants will now be stored in a link-based sorted list. 2. Student applicants will be organized into two lists: one for female applicants, and one for …

Member Avatar for Lerner
0
155
Member Avatar for MattyRobot

i have spent some time trying to install glut in code blocks and so far I haven't succeeded. i have downloaded the glut-3.7.6-bin [URL="http://www.xmission.com/~nate/glut.html"]from here[/URL] . I have looked at tutorials on where to put the files in the download ([URL="http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/#win"]like here[/URL]) but it doesn't work. :icon_question::icon_question::icon_question:

Member Avatar for Mallot
0
292

The End.