49,757 Topics
| |
Hey, I have a generator but it works dependently on time, so it makes new values only every second. Is there a way to make it work faster? I want to be able to generate new numbers every millisecond if possible. [code=C++] srand((unsigned)time(0)); int a; int b; int c; int … | |
Hi, I'm new to pointers. i got some requirements...... Following is my requirement.........i want to use a double and triple pointer array [2D,3D] and in that double pointer i want to get data from the user.how can i achieve that using malloc and free for assigning and deallocating memory. im … | |
Hello, I started c++, and I recently got an assignment, which is supposed to calculate the sum, variance, mean deviation, and mean in a set. The user can input any number positive or negative for the set. Because it is a set, the person may enter as many numbers as … | |
Need help from u all am a newbie here!!! making a 2D project, snap link is given below [url]http://i238.photobucket.com/albums/ff224/umairqureshi_6/back.png[/url] here i have to blast the ship which is moving downward on x-axis with a cannon ball ,on the mountain the function i am using for projectile trajectory is ---------------------------------------------------- void … | |
I am trying to figure out a way to use maps to keep a total number of items. I was using arrays before [CODE]total[x] = total[x] + (function to add another int);[/CODE] Now I made total a map, but have no idea how to get the same result. Gives me … | |
my desired output is this: Input number of process to simulate SJF: 4 Input burst time for each process: P1 = 7 P2 = 4 P3 = 1 P4 = 4 Input Arrival Time for each process: P1 = 0 P2 = 2 P3 = 4 P4 = 5 Now … | |
I don't know why my compiler didn't like my for loop [CODE]#include <iostream> using namespace std; int main() { cout<<"Please enter an integer.\n"; int intege; cin>> intege; cin.ignore(); cout<<"Please enter it again." for ( int inte = 1; inte = 1; ) { cin>> integ; if (intege==integ) { inte=0 cout<<"Thank … | |
Here's what Im trying to do... Write a program that asks the user to guess the next roll of a six sided die. Each guess costs $ 1. If they guess correctly, they get $ 100.00. The player will start out with a $10.00 bank. Each time he (or she) … | |
I am trying to pass a two dimensional array to a function and modify it. I understand that two dimensional arrays are automatically pass-by-reference parameters so that solves half of the problem. However, when I try to compile the code: [code=c] #include <cstdlib> #include <iostream> using namespace std; int x, … | |
I've writen a simple calculator code it is pasted below. What do I need to change in order to make it loop using a "while" statement until, the user inputs the letter ("Q" upper or lower), casuing it to exit the program instead of a function such as(/,*,-,+).. please help... … | |
I'm working on this project and I'm REALLY close, I'm just gettin a C2059 error and I have no idea why? [CODE] #include <iostream> using namespace std; int main() { int guess; int die; float total = 10; char ans; cout << "Welcome to Dice Roll!" << endl; cout << … | |
how can i make a basic calculator on turbo c++ that the result is can be used again and again to any operation | |
i can see the light at the end of the tunnel after working on this thing for 6 hours strait but i am faced with a last few errors. First here is the code: it is really long. the error statements are: 'seriesParallel' : undeclared identifier seriesParallel' : undeclared identifier … | |
i have declared [CODE] char arr[10][10]; [/CODE] and did this: [CODE] for(i=1;i<=n;i++){ arr[i] = (char)i; } [/CODE] but it wouldn't work.. i want to put the number inside the array.. y does this error? | |
The program at work now will end up in a drawing third dimension editor. I draw in the window but when I touch a window's control (a menu option, maximize, minimize buttons, other window, etc...) the image at window disappears, do I have to redraw everything? if so, which controls … | |
Here are the two functions that I'm trying to get to work together. Anyone know how to call my overDraft function into my withdraw function if statement? Thanks. bool withdraw(double amt, int pin){ if (amt <= bal) return true; if(amt >= bal) return ????; //Need this to call my overdraft … | |
For some reason, it works when I just do the entering the name part it works fine, but with the rest of my program I'm having a problem. I'm trying to have the program make it where they enter a password to get in the program (Which I got to … | |
I am trying to write a function that relates a color; for example, brown with a number, say 1. so when the user types brown 1 will appear, etc. [CODE]int colortonumber (int x) { int nka; switch (x) { case 'brown': nka=1; break; case 'red': nka=2; break; case 'orange': nka=3; … | |
Write a program that illustrates the growth of the world's population using as input: the start year the initial population size the annual percentage increase of the population the end year. You may assume that the input is valid. Output the year, the size of the population and the population … | |
I am writing a code for arithmetic compression. But my problem is i can't open the file 2nd time for reading. code is: [CODE] #include<iostream> #include<fstream> #include<stdio.h> #include<math.h> using namespace std; #define MAX_SYM 255 struct node { char ch; int count; /*public: node() { //cout<<"constructor at work. \n"; count =0; … | |
hii all , I need to assign either 1 or -1 randomly to an 3 dimensional array where 1 corresponds to orange and -1 corresponds to blue can someone help me in C++ code Thank You, chin | |
Hello everyone. I am trying to copy data from a file stream into a char*. I know there are ways to do it with std::string and getline, but I have an assignment where I have to have a class that will take a char* into one of its constructors (which … | |
So I'm having trouble performing a linear search of a linked list class. The inList() search function is supposed to recieve a value for an element and search for that element, return a bool value based on whether or not the value is in the list or not. Below is … | |
Hello guys. I have some problems with ofstream and CFileDialog. I use this code to get file location: [CODE]CFileDialog fileDlg(TRUE); if (fileDlg.DoModal() == IDOK) { FilePath = fileDlg.GetPathName();[/CODE] And after that i try to write something to file wich don't exists. So ofstream have to create a new one. [CODE]std::ofstream … | |
to prepare a serial version of a program to illustrate patterns of Gator fan coloring. Gators are fond of the colors orange and blue. They tend to dress in either one color or the other and frequently change their minds about their color based on the colors of the people … | |
Hallo! I've been having some trouble getting a save/load function to work properly. I'm trying to save object and their properties to a file in binary using fstream. And then being able to load the object from the binary file the next time im running my project. Quick breakdown: I … | |
hello, I wanted to ask you all a question. suppose that my c++ program has read from a text file a set of characters like the one below using the command inData >> temp. i output the characters of the text file and stored all the characters in a string … | |
Hey all , I'm writing a Windows program & i'm having a very silly and annoying problem. I Create a very simple Dialog(It's a window actually) with one text box and one button , then i try to use SetFocus() function to Give the focus to the text box so … | |
this code is for bessel function Y n (x) 2nd kind I'm in the level 4 at computer engineering my prof. gave me that assignment , I want help to improve it to get an accurate results thanks! | |
OK, here is my dilemma, I am trying to read an input file into 3 arrays. The file must be formatted as such (ie - with each value on a new row): 3 - n value for an n x n matrix 'a' 1 - a11 - Next n^2 terms … |
The End.