49,761 Topics
| |
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 … | |
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 … | |
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 { … | |
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 … | |
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 … | |
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 … | |
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 … | |
#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, … | |
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 << … | |
Hey guys,how can i retain the output window when stdio is used as my header? | |
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 … | |
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 … | |
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 … | |
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! | |
how to write the fibonacci series by accepting the value of terms of the series from the user? | |
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 … | |
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 … | |
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 … | |
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 … | |
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? | |
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 … | |
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(); … | |
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. // // // … | |
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] … | |
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 … | |
#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}; … | |
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 … | |
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 … | |
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 … |
The End.