49,761 Topics
| |
This week in class we are looking at functions and how to use them. This is the example we got during class: [CODE]#include <iostream> #include <string> using namespace std; //function prototype int getTotal(int,string); void verifySeasons (int&); int main() { string name; // name of player int totalGoals = 0; // … | |
Hi friends, I am a final year Mechanical Student and I am doing my Final year project in C++. My project requires some complicated programming in C++.. Here are the details. Initially I need to create a random matrix. The user will give the no of rows and columns. For … | |
[CODE] /* Fabrice Toussaint section N938 Feburary 1, 2011 Purspose of program is to locate centroid and find distance between all three points and centroid */ #include <iostream>// for cout and cin #include <cmath> // for sqrt () and pow (x,y) using namespace std; int main () { float distance1; … | |
I use Microsoft Visual Studio Professional on my Desktop PC, but my GTX 260 just failed and im dojng an RMA, so I started trying to program on my laptop. I am around 1/3 of the way through Ivor Hortons Beginning Visual C++, the book covers Native C++ and C++/CLI, … | |
HI Everyone ! Do anyone know how to split string ? Especially this one . Do anyone know funtion "__DATE__" , it show month/date/year. you know ,it is string so i want to separate it because i need month to make condition. | |
First of all, hi everyone! Im a C++ newbie and i'd like to get a good grasp of the concepts soon. I'm currently working on this [CODE]#include <iostream> using namespace std; int main() { int i, j, lines; cout << "This Program creates Christmas Trees." << endl; do { cout … | |
Hi Folks, I've been looking around all day and I've tried numerous suggestions, but to no avail. I've got a struct in C# defined as: [code] [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct GenericTrackRecord<T> { public Int32 hasValue; public T value; } [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct OTXFixDetailsStruct { public … | |
Hi all, I was hoping for some help and hints to the problem i'm facing now. Right now i have a a 2D array which stores the elements: 22Jan11 180 11Feb11 111 22Jan11 90 22Jan11 30 25Jan11 110 I'm trying to basically add up the the value of the duplicate … | |
[CODE]// This program is supposed to figure out how much does a custom banner cost by figuring out the price for each letter and outputting it's total to the screen. #include <iostream> #include <string> using namespace std; int main() { double cost, total; string banner; cout << "Enter Your Banner … | |
Hi, I'm using C++ without MFC nor ATL, to create a popup, opening from a DLL loaded in Internet Explorer as Browser Helper Object (all versions from IE7, from XP to Windows 7). Until now, everything went find and my popup is working as I wish. But now I'd like … | |
Im doing a code "test" from the c++ book I am currently reading, the objective is to ask for input using a function and output data using a function, while keeping the data in main. I finished it and it works, but I want to make the program not accept … | |
Hi, I'm writing a small piece of code finding the number of unique 3D arrays in a N*3 array. I first sort the N*3 array, and apply a "condition" function : if the consecutive 3D arrays do not have the same element, then the unique number count +1. Here is … | |
[CODE] class X { public: X () : myID(id) {} X (const X& right) : myID(++id) {} friend ostream& operator<< (ostream&, const X&); private: static int id; int myID; }; int X::id = 0; ostream& operator<< (ostream& os, const X& x) { return os<<x.myID; } X f (X x1, X& … | |
hi to all, can anyone tell me about streambuf and filebuf classes...i got to know that ios contains a pointer to streambuf....so it must be something important ,right?..... | |
I need to yourhelp,too. can you write this programm :sum and multy 2 sparsematrix with linklist?(language c++) | |
Hi...I want to create a timer so that after completing the time(suppose 10 sec) the control should come out of the function..Please note that am starting the timer inside the function..is this possible in c++... | |
Hi, If I'm not mistaken, the following code will allocate 5 integer elements from memory to 'ptr': [CODE] int *ptr; ptr = new int[5]; [/CODE] If after this code I enter the following: [CODE] ptr = new int[7]; [/CODE] will the original 5 elements be overwritten or deallocated? Or will … | |
Here is my code: slist.hpp [CODE]#ifndef SLIST_HPP #define SLIST_HPP #include"slist.h" #include"slistiterator.h" #include"slistiterator.hpp" template<typename generic> SList<generic>::SList() { m_size = 0; m_front = NULL; } template<typename generic> SList<generic>::SList(const SList<generic>& s) : m_front(NULL), m_size(0) { *this = s; } template<typename generic> SList<generic>::~SList() { clear(); } template<typename generic> void SList<generic>::push_front(generic x) { SNode<generic>* temp … | |
HEllo Everybody..... feels nice to be part of daniweb..community..joined only today...... i am quite ignorant of XML.....but now i have to develop a c/c++ program which reads a XML file......stored on LAN.....retreives the content of the file...and do necesarry manipulation with the retreived data......actually the xml file contains the name … | |
how to create a function that will count and display all even numbers . the function will populate 30 integers with random 2-digit number and return count of even numbers ? | |
I have been working on this program for about a week and i have been getting these errors that i just cant get by. The program is supposed to first accept user input for the type of symbol. Then its supposed to accept user input for a number. Finally it … | |
Hi, I have this simple code: [CODE] const int kiCharSize=30; const int kiDate=7; struct Customer{ char caName[kiCharSize]; char caSurname[kiCharSize]; char caCity[kiCharSize]; char caPhone[kiCharSize]; char caDate[kiDate]; char cDay; enum eDay{M,A}; char caBrand[kiCharSize]; }; blablabla Customers::Customers(int x){ switch(x){ case 1: Cust.caBrand="HolyBrand"; Cust.caCity="Heaven"; Cust.caDate="110205"; Cust.caName="Jeesus"; Cust.caPhone="999333999"; Cust.caSurname="HolySpirit"; Cust.cDay='M'; break; case 2: Cust.caBrand="Brandutsu"; Cust.caCity="Japan"; … | |
Hey all! Long time reader, first time poster! So I'm trying to communicated between two processes on a UNIX machine using shared memory. I believe everything in this program is working fine except for how I'm attempting to call the memory to check. Basically the parent process writes to the … | |
[CODE] int main() { double t[]={15.70, 29.39, 41.14, 56.47, 75.61, 98.83 ,112.42, 125.61, 129.39, 133.45,138.94, 141.41, 143.67, 144.63, 144.95, 145.16, 146.25, 146.70, 147.26 , 148.15, 152.40}; int n = sizeof (t)/sizeof (t[0]); FindLN(t, n); return 0; } void FindLN(double t[], int n) { int index; double lnt[n]; for (index=0; index<n; … | |
I really don't know how to capture the information from the bitmap file when talking about the pixelArray, I know what I have to do it when I capture it to turn it negative, but each time I run my code it crashes when I run the code I think … | |
Hello guys. I'm stuck at my algorithm assignment. Here is the problem. We found that the solution to the mergesort recurrence f(n) = f(┏n/2┓) + f(└n/2┘) + n, f(1) = 0 satisfied f(n) = Θ(nlogn). Find an expression for the exact value of f(n). (Hint: generate the first 20 to … | |
Hey Im tryin to make a simple project which is pretty simple, but I cant seem to get it right :P Anyways, it goes like this. I have the main file which creates the window and stuff. And then I have an other file which populates the main file with … | |
I was told that I could compact this code in 2 ways. I can't use loops. Can anyone see it? #include <iostream> #include <string> using namespace std; void daysOfChristmas (int days, char switcher, string b[12]){ (days > 0 && switcher == 'y') ? daysOfChristmas(days - 1, 'y', b): false; (days … | |
Okay so I wont to output text onto my win32 program. I read somewhere that TextOut() is the function i need but it is not as good as DrawText(); Ive been trying to use DrawText() but i get stuck at the 4 parameter asking for a RECT. Any help ? … | |
I don't know what it means: [CODE] class Tree{ friend ostream& operator<<(ostream&, const Tree&); private: TreeNode *Root; void insert(TreeNode*&,int); void PrintInOrder(TreeNode*); int Median(int[],int&); public: Tree(); Tree(int); void insa(int[]); void ins(int); void print(); }; ostream& operator<<(ostream& out, const Tree& tree){ out << tree.Root ->GiveValue(tree.Root); return out; } Tree::Tree (){ Root = … |
The End.