49,761 Topics

Member Avatar for
Member Avatar for Learner010

consider the following code afunction(int *x) { x=new int; *x=12; } int main() { int v=10; afunction(&v); cout<<v; } i expected `12` as the output but its wrong and correct one is `10` . But i don't know how this is done internally ? i was wondering if somebody could …

Member Avatar for StuXYZ
0
148
Member Avatar for ashley.vanhoesen.7

I need to remove the spaces and punctuation from the original string and the reverse string, then put the letters only into temp strings for comparision. When I run the output as it is now, I get 0000 for the temp strings. How do I fix this? Everything else is …

Member Avatar for mike_2000_17
0
682
Member Avatar for mxwarning

I am having a trouble calling my addsomethingup() function in my program. I keep getting the error too few arguments. Can anyone help me understand why this is not working please? #include <iostream> #include <string> #include <iomanip> using namespace std; using std::cout; // //CLASS DECLARATION SECTION // class EmployeeClass { …

Member Avatar for Learner010
0
255
Member Avatar for saif.shafqat.5

can any body please tell me that how to take input size of a matrix in 2 d array an then print the table of it.... sample output 1 2 3 4 5 2 4 6 8 10 3 6 9 12 15 4 8 12 16 20 5 10 …

Member Avatar for Ancient Dragon
0
322
Member Avatar for pinkamech

Hi, I am currently working on a UNO Game using C++ and I am facing some troubles. I need to use Vectors and Pointers (for the main bulk for this assignment). I am wondering if anyone could kindly help me because the deadline is on Wednesday and I feel very …

Member Avatar for pinkamech
0
5K
Member Avatar for Vikram Sehgal

So I have made a menu and a guy helped me, We have used enum in the menu is there anyother way i can do it, cause my teacher is not allowing me to use classes, files and arrays, please help, if u guys have anything simple and better i …

Member Avatar for Stavros_1
-1
282
Member Avatar for nitish.mohiputlall

here is the question: "write a program , which has as content "time is a great teacher but unfortunately it kills all its pupils" and outputs th reverse string to the disk file out.txt. My problem is that im stuck with the part on how to display the sentence in …

Member Avatar for VertexF3
0
147
Member Avatar for Praveen_10

#include <cstdlib> #include <ctime> #include <iostream> using namespace std; int findSmallestRemainingElement (int array[], int size, int index); void swap (int array[], int first_index, int second_index); void sort (int array[], int size) { for ( int i = 0; i < size; i++ ) { int index = findSmallestRemainingElement( array, size, …

Member Avatar for vmanes
0
316
Member Avatar for arashe

please help me i need a dynamic array that get the information as a matris and give me the vertex degrees (sum every row).and send it to another matrix. #include "stdafx.h" #include<conio.h> #include<iostream> #include <stdlib.h> #include <string.h> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int k,sum; cout << …

Member Avatar for Schol-R-LEA
0
369
Member Avatar for iblanq
Member Avatar for hades2610

I want to devide the text in file data.txt into an array of char*( mean i use the pointer char** q) by the way line 1 for q[1], line 2 for q[2] and.... but i don't know why it not work can everyone help me ??? :( char **q; const …

Member Avatar for Ancient Dragon
0
379
Member Avatar for Vikram Sehgal

is there an easier way to write this code?? without using enum, enum MenuState{MenuPlay,MenuHelp,MenuExit}; MenuState ms=MenuPlay; char ch=0;//or anything other than '\r' while (ch!='\r')//IIRC getch returns '\r' when user hits enter { switch (ms) { case MenuPlay: cout<<"--> PLAY\n HELP\n EXIT\n"; break; case MenuHelp: cout<<" PLAY\n--> HELP\n EXIT\n"; break; case …

Member Avatar for L7Sqr
0
266
Member Avatar for sana.f.qureshi_1

Hello again good people, i have done some coding on lexical analyzer phase of compiler but it is giving me some error that i am unable to understand.. Fair Warning: Code is a little longer. Here is the code: # include <iostream> # include <fstream> # include <string.h> # include …

Member Avatar for VertexF3
0
1K
Member Avatar for William Hemsworth

Saw [this](http://www.daniweb.com/software-development/cpp/code/216430/add-a-little-graphics-to-your-console) and decided to make a little spinoff with some physics of mine. Enjoy!

Member Avatar for YassinTAH
1
446
Member Avatar for Dagmawit

how to write the fibonacci series by accepting the value of terms of the series from the user?

Member Avatar for danyal baig
0
153
Member Avatar for Auroch

Hi, I have the following problem: Text file "strlines.dat" contains series of the following information of straight lines: 1) coordinate of one line's point 2) angle slope It looks like (x,y) 45 deg: 2,6 60 4,7 45 2,1 30 After adding this information to associative container verify it and find …

Member Avatar for Auroch
0
208
Member Avatar for mystycs

Is there a way to sort a vector with a class that has an int variable? I want to have my vector sorted and printed in console. I want to be able to sort the vectors. Say i create a bunch of vectors here on user input `vector<PCB> Disks2[DiskDevices];` Basically …

Member Avatar for Schol-R-LEA
0
414
Member Avatar for nhiap6

Could someone please sum up all the information or give me a link to a website why C++ is used for system programming. Ok, am realy on deadline for finishing my last highschool paper and I know this sounds like a homework question but I look it up on web …

Member Avatar for NathanOliver
0
186
Member Avatar for bejfake

Hi, I need to link a library you can download from producer's site (http://www.dahuasecurity.com/download_3.html) to my c++ project. The library is named General_NetSDK_Eng_Windows64_IS_V3.40.2.R.130321.7z. I tried to: * Linker->Input : added to addidiontal dependencies lines: dhnetsdk.lib dhconfigsdk.lib * Linked->General : added to additional library directories a "D:\dahua\" directory which includes files …

Member Avatar for bejfake
0
536
Member Avatar for mystycs

Is there a way to mimic creating multiple queues like this but with priority queue? This is what i have but i want to now use a priority queue. queue<PCB> Disks[DiskDevices]; I tried this but it doesnt work. priority_queue<PCB> DisksTest[DiskDevices]; It wont compile? What am i doing wrong?

Member Avatar for mystycs
0
488
Member Avatar for Emma_3

I'm trying to store the contents of a file containing names of herbs and spices (items) in a 2D array called PantryContents. Then I'm trying to add an item to that array. It seems like only one item is being stored at a time, but the output is correct but …

Member Avatar for Emma_3
0
262
Member Avatar for learner_new

Here is my code. #include <iostream> #include <math.h> #include <winsock.h> #include <windows.h> #include<stdio.h> #include<stdlib.h> #include<string.h> using namespace std; int main() { SOCKET s; WSADATA wsadata; int error = WSAStartup(0x0202, &wsadata); //Did something happen? if (error) return false; //Did we get the right Winsock version? if (wsadata.wVersion != 0x0202) { WSACleanup(); …

Member Avatar for BobS0327
0
338
Member Avatar for phony

I get an error when I try to compile my code. I can't figure it out. It says it's not declared but I think it is declared. // // // This menu-driven program is used to allow the user to choose // an application to be executed. // // // …

Member Avatar for phony
0
759
Member Avatar for Sarkurd

Hi i was following a tutorial but i stuck at something i don't understand it This is to find out how many times a number appeered inside an array sorry for my English #include <iostream> #include <conio.h> using namespace std; int main() { const int size = 5; int arr[size] …

Member Avatar for Sarkurd
0
307
Member Avatar for nitish.mohiputlall

Here is the question: Write a program that creates a queue of Strings and allows the input of an integer value n, followed by n names to be placed in the queue. Then the program should execute a loop that performs the following: 1 It displays the name in the …

Member Avatar for Moschops
0
137
Member Avatar for software girl

#include<iostream.h> #include <stdlib.h> //FOR exit(1) struct Flight { char flightNo[5]; char date[12]; char time[6]; char gate[3]; }; Flight flight={"AB11","10-12-2008","20:30","RT"}; struct Seat { char name[40]; char booking_ID[3]; int seats; }; Seat choice[4][5]; void displaymenu(); void booking(); void seat(); void ticket(); void records(); void menu(); void exit(); //Variables int selection,i,j,password; int seats_num[20]={0}; …

Member Avatar for Ancient Dragon
-1
283
Member Avatar for evaxhoxha
Member Avatar for amt_muk

Hello, Please help me to overcome the following confussion. Suppose I have created an array of pointers like, A** l_aAPtr = new A*[l_iTotal]; for(int i = 0; i<l_iTotal;i++) { l_aAPtr[i] = new A(); } Now I want to delete this array. Please advise which of the following way is correct …

Member Avatar for amt_muk
0
235
Member Avatar for chubbyy.putto

I dont no how to fix. Can someone help me out plz. (Please see the picture) [IMG]http://i61.tinypic.com/2r2cfnq.png[/IMG] #ifndef DYNINTSTACK_H #define DYNINTSTACK_H class DynIntStack { private: // Structure for stack nodes struct StackNode { int value; // Value in the node StackNode *next; // Pointer to the next node }; StackNode …

Member Avatar for Schol-R-LEA
0
159
Member Avatar for mxood

ok i am very sorry if this comes off as irritating to some, but i need someone to reassure or direct me. i have learned some programming, very very basic to be exact and i have learned some c# and some C++. the problem is, I like c# because it …

Member Avatar for rubberman
0
244

The End.