49,757 Topics
| |
Hello, I am writing a section of c++. Here is the section that does not work: [code=c] int a, escape; double temp1,temp2; escape = 0; a = 0; while(escape < 2){ Complex c[a]; cout << "Please input a complex number, the real part follwed by the imaginary part.\n"; if(!(cin >> … | |
Hi, I wrote this code for C++ Primer Plus, but I don't really get why it doesn't work. [CODE]#include <iostream> #include <cctype> using namespace std; int main() { char ch; string str; int vowels = 0; int consonants = 0; int others = 0; cout << "Enter words (q to … | |
Greetings all DaniWeb people, long time no see. I have a (hopefully) easy question. Let's jump into the code. My test harness: [CODE] cout << "--------------------------------------------------------" << endl; cout << "Begin Copy Constructor Testing" << endl; cout << "--------------------------------------------------------" << endl << endl; dlSL = new DLSortedList(); for (int i … | |
Are static variables allocated in the heap or on a thread specific stack. Thanks | |
Hello, I'm new to c++ and we're just starting classes and objects in class. I've done a bit of programming in Java and I'm struggling to initialize an object using a variable. I must be missing something fundamental but I can't for the life of me figure it out. Here's … | |
can anyone tell me the source code in the attached file("mtb.dll") | |
[B]I'm new to C++ and I need help in writing code:[/B] Lucy likes to jog in the morning. As she jogs, she counts the number of strides, she makes during the first minute and then again during the last minute of her jogging. She then averages these two numbers together … | |
QUESTION? (TIME TABLE) YOU ARE THE OWNER OF A RAILWAY SYSTEM BETWEEN n CITIES, NUMBERED BY INTEGERS FROM 1 TO n. EACH TRAIN TRAVELS FROM THE START STATION TO THE END STATION ACCORDING TO A VERY SPECIFIC TIMETABLE (ALWAYS ON TIME), NOT STOPPING ANYWHERE BETWEEN. ON EACH STATION A DEPARTURE … | |
Hello , The following function takes a number x and returns the sum of all numbers before n. For ex. when x = 5 the function should return 4+3+2+1. [CODE] unsigned long long rep(int x) { if(x==1)return 1; return x + (rep(x-1)%314159); } [/CODE] I'm getting a segmentation fault with … | |
[CODE]#include <iostream> #include <fstream> #include <iomanip> #include <cmath> using namespace std; int main() { char fare; char choice='Y'; int hrIn, minIn, hrOut, minOut; int hours; int minutes; int total_minutes; double cost; float charge; while(choice=='Y'||choice=='y') { cout << "\nThis program will calculate a group " << "\nfare amount which is then … | |
I need help with this assignment that I have to do. I am new to C++ programming and I do now know how to start this lab. Here is the instruction to the lab..please help.. COMP-122 Lab 6 Grade Arrays Objectives: • Use an organized, modular approach to develop programs, … | |
Hi. I using this Thread "Serial port communication using C++ = "http://www.daniweb.com/forums/thread56329.html" and I change it for solved the some error in program. This is my source code: serial.h #[CODE]define FC_DTRDSR 0x01 #define FC_RTSCTS 0x02 #define FC_XONXOFF 0x04 #include <stdio.h> #include <time.h> #define VC_EXTRALEAN #include <string.h> #define ASCII_BEL 0x07 #define … | |
[CODE]void CScreenCoordDlg::OnMouseMove(UINT nFlags, CPoint p) { GetCursorPos(&p); m_ValX = p.x; m_ValY = p.y; UpdateData(FALSE); }[/CODE] I used the following code to get the mouse coordinates on mouse move. But the problem is as soon as the mouse moves out of the dialog window it stops updating the mouse coordinates. Although … | |
I have had no previous programming experience and want to start learning C++. T was hoping if you could reccomend a good book. P.S. I've been thinking about [I]C++ Primer Plus[/I]. | |
im curious as to why when i make a dll win 32 project in visual studio 2010, it doesnt show my dllmain function so i can work off that and leaves me with an blank .cpp.(and no i didnt click empty project). How can i fix this? -thx | |
i have a program that would display the productName,productPrice,productCode. each is a separate array. the program would prompt user to add,delete,or search a productName,productPrice,productCode. here's what i tried to do: [CODE]string productName[100]={"milk","beef"}; int productPrice[100]={10,11}; string productCode[100]={"a1","a2"}; int x,y,z; char choice; string search,name,price,code; cout<<"what do you want to do?"; <<"[S]earch."; <<"[A]dd."; … | |
I just got a program that does forward substitution. It is working fine but I would like to make it so the user can enter size of both 2D n x n array and a n x 1 array and then be able to enter the elements of the arrays. … | |
I'm trying to make a program that will scan the screen for a certain color. i tried to use GetPixel(), but it is too slow. someone else recommended i use GetDIBits(). Can anyone explain or give an example source on how to scan the screen for a certain color with … | |
Hey everyone. I'm brand new to C++ and programming in general and this is my first post here. I've found lots of good info here and these forums helped me a lot last semester. I've got a problem here though. This is a small bit of code I had to … | |
Hi, I have an assignment where i'm supposed to read from a Input File and save it to an output file. The final expression should only contain alphanumeric characters. The code that I have so far gives me both symbols and alphanumeric characters. I was wondering if anyone saw anything … | |
The function Generate_And_Display_Bill() has no formal parameters and returns a variable of type float. The function generates a random number between $0.01 and $99.99 and returns the value to main(). This is what I've created so far in my function declaration; [CODE]#include <iostream> #include <ctime> float Generate_And_Display_Bill() { float Random_Bill; … | |
I am using the CodeLite IDE. I compiled the following program using CodeLite (It is a C++ program): [CODE]#include <iostream.h> int main() { cout << "Hello World\n"; return (0); }[/CODE] It returns this message: g++ -c "/home/keagan/.coding-work/Hello/printamessage.cc" -g -o ./Debug/printamessage.o "-I." "-I." /home/keagan/.coding-work/Hello/printamessage.cc:1:23: error: iostream.h: No such file or directory … | |
[B]QUESTION 1[/B] In this line of code, I get that it's using the date/time to seed the code for a more random number each time, I'm just wondering what the < > operators are doing? [CODE]srand(static_cast<unsigned int>(time(0))); [/CODE] I realize, they're making time into an unsigned int, but why not … | |
All, I’m new to C++ and trying to figure out the best way to do a multidimensional array of pointers to a class. The code I am presenting demonstrates several questions I had and am hoping to get some help with each question. The basic idea is to create myMatrix, … | |
I have a sockets projects using tcp/ip and it is structured like this: [code] class Socket { int desc; Socket(); // create socket here }: class TCPSocket: public Socket { public: int send(); int recv(); }; class ClientSocket: public TCPSocket { public: void connect(); }; class ServerSocket: public Socket { … | |
In the book I'm studying we are given a function to make rand() work for numbers that are smaller that RAND_MAX [CODE] int nrand(int n){ if(n <= 0 || n > RAND_MAX) throw domain_error("Argument to nrand is out-of-range"); const int bucket_size = RAND_MAX/n; int r; do r = rand()/bucket_size; while(r … | |
I have a program that I've written...basically the problem starts when I reach the condition to hit the following block: [CODE] status = myPubSubSubscribe.Receive(fsReceivedTopic, myBufferSubscribe, myHeader, 0); if (status == PS_ENGINE_UNAVAIL) { printf("Unable to connect to the pubsub engine: %s\n", PSPubSub::Status2String(status)); myBufferPublish.FreeBuffer(); myBufferPublish.~PSBuffer(); myPubSubPublish.~PSPubSub(); myBufferSubscribe.~PSBuffer(); myPubSubSubscribe.~PSPubSub(); return; } [/CODE] In … | |
[CODE]// ---------------------------------------------- // Name: William Rennie // Program: // Description: // ---------------------------------------------- #include <iostream> #include <cstdlib> #include <stdio.h> #include <string.h> using namespace std; // ----------- Function definitions ------------- void printTitle(int gamenumber){ gamenumber++; cout<<"***Word guessing game round "<<gamenumber;} bool checkWord(char word[],char guess[]){ int i; int x=strcmp(word,guess); if (x==0){return true;} else return … | |
Working with large int numbers. Broken up as char for each digit, total of 3 arrays, n1, n2, and sum. I have everything completed, the math works fine, the arrays work fine, the shuffling to the right side of the array works fine. I just have two issues, that both … |
The End.