51,592 Topics
![]() | |
Here is the Quesion :: I want to write a program that estimates the value of the mathematical constant e by using the formula: `e = 1 + 1/1! + 2/2! + 3/3! + 4/4! + ………+ n/n!` Here is my Answer: #include <iostream.h> int main () { double x … | |
would a connect 4 game really be hard to make with like a 5x5 board if you make it from scratch and without the help of some premade libraries? need an answer asap cause i need to decide whether i would continue with my connect 4 game or change it | |
Hi all, I'm trying to write the code for a program that will convert MPH to KPH and vice versa. Here is what I have so far.... [code=cplusplus] #include <iostream> #include <iomanip> using namespace std; int main() { const double kph_to_mph = 0.6214; int kph; double mph = kph * … | |
I have 3 instructions- 1- Use rand() to generate a number less then 100 and greater than 1 2- Call the prime() function to test the result 3- Print out the result So far i have found how to get a prime number but don't know how to fill up … | |
i have made this program for creating and traversing binary search tree. for inorder, it is working well but for post and pre order it showing wrong results .i could not be able to get the problem .could some one please tell me problem regarding this program .it is written … | |
hi there i'm new here i hope you can help me through this homework i've read like 14 pages of topics about seekg and fstream.. and well.. they didn't solve my problem. my homework it's about creating a text file from "b to z" without the vocals, then reopen the … | |
how can i get this convert an array to MPH if data represents KPH equation:multiply by 5/8 | |
ok so what im trying to do is to read some text from a file. Put them into an array. And count the number of characters in the text file using pointers to access the array. However, when i compile i get an error for this line [B]check = isalpha('*text');[/B] … | |
I've spend a lot of time working on a bunch of classes (point, vector, ray, triangle, plane) etc to work with these objects and their intersections in c++. However, now that I am ready to do a full scale project with them, I am finding they are terribly slow! I've … | |
hi everyone, im having problems with my loop in my assignment im working on. im not tryin to get the code from you guys. but would like some pointers on what im doing wrong. im tryin to figure out why my "else" code wont work? i've tried to look for … | |
So explicit parametric polymorphism need not be restricted to a single type parameter. In other words I can write this in C++ [CODE]template <typename First, typename Second> struct Pair { First f; Second s; };[/CODE] Can someone help me write a funciton "makePair" that takes two paramters of different types … | |
hi i am trying to count the occurrences of different words in a string array. while(end of array) { while(end of array) { compare ith element with all other elements inc counter } increment the element number } but i guess something is terribly wrong here as i am not … | |
im brushing over some of my notes for a midterm tommorow. questions i have when i was reading: what exactly does a parameter do? i know it passes a value to a function-but how is it always like that? or is it more complicated than that? is it kind of … | |
What are the benefits of using the Conditional operator (?) over a traditional if/else statement or similar? Using ? seems to lower readability in some cases but anything else? | |
How do i make an array class that contains pointers to objects? (in this case, object of type travel.) right now all i got is array of object, not pointer...... [code] class Array { public: Array(); Array(int size); Array(const Array & anArray); ~Array(); friend ostream& operator<< (ostream& out, const Array … | |
I am thinking about becoming a programmer and have a BA in socail science and computer tech certificate. Can I ge a job with just either a C ++ certificate or Java certificate. Which one would be better to take. Please advise. | |
Hello, I'm pretty new to C++ and I've been trying to this program to open a file and check if it exists for the last two hours. It seems like it should be so simple but it keeps eluding me. Here is the code in main that starts to run. … | |
I would like to be able to find out the pitch of some audio recorded in a wav file and want to know the best way to go about doing this. I am using VC++ 2008 | |
Hey there, everyone. Here is the question I had to write code for: Include the following code: char test[15] = {‘T’, ‘h’, ‘i’,’s’, ‘_’, ’i’, ’s’, ‘_’, ’a’, ‘_’, ’t’, ’e’, ’s’, ’t’}; for (int row = 0; row < 15; row++) { cout << test[row]; } Add the code … | |
int numberArray [9][11]; write a statement that assigns 145 to the first colum of the first row of this array. write a statement that assigns 18 to the last col of the last row of this array this is what i have [code] numberArrray [1][1] = 148; numberArray [9][11] = … | |
If I have these function variables: int (*f)(int); int (*g)(int); int (*h)(char); why can I do the assingment f=g but if I do h=g the C compiler gives me warning while the C++ compiler gives me an error. Can any one please explain this to me. | |
i wanna put all my variable initialization at a header file.. but after i put in a header file name, "variable.h" i #include "variable.h" in main. but it still cant reconize the variable. what can i do? + extern infront all the variable in header file? | |
I am a beginner I spent many hours studying c++ books and online tutorials, I am sure I am competent enough to become a good programmer but I cant wrap my mind around how c++ (or any programming language for that matter) works. My question is, How do I understand … | |
The following code, excerpted from a much larger program, triggers a C++ compile time error as shown in the leading comments. [Re-]declaring variable 'w' to be a 'const char *' will fix the problem, but I don't know exactly why. I would greatly appreciate it if somebody could elucidate the … | |
Hi I'm working on the following code which is to be used on the M16C/62 microcontroller. Basically the microcontroller is to [B] "scan the keypad and display any key that is depressed" [/B](which i have done im pretty sure), on the LCD. However I know I have to Sound the … | |
[CODE] // filename = isbn.cpp // Kyle Burmark // Prof. Gelotte // 02/12/02 // Program 4 - Validate ISBN numbers program // Description: This program asks the user whether he wants to validate // ISBN numbers from his own input or from a file of isbn numbers // Start program … | |
This is my relatively simple code. Its just part of a memory matching game. I've looked but I cannot figure out why it won't switch the values in each of the array indexes. I would appreciate anyone helping me out here with this. ** Turns out the problem is that … | |
[code] #include <iostream> #include <iomanip> using namespace std; void celsius(int); int main() { cout << setprecision(2) << fixed << showpoint; cout << "This program displays a table of the Fahrenheit temperatures" << "\n0 thorugh 20 and their celsius equivalents.\n"; celsius(0); return 0; } void celsius(int fahr) { double cels; cout … | |
Hello everyone, I am a Mathematics major and my mentor asked me to put together a program that evaluates explicit stencil methods along the difference mesh. Basically I need to use a recursive method to get my value, as I know base values and boundaries, but the C++ experience I … | |
Im trying to make an annogram. first you input a word, and then it mixes it up and then couts the scrambled version of the word. My problem right now is that when you input a word like "Cat", it will mix up and look like "aCt" or something with … | |
Okay, I've been noticing this for a while now and decided I might as well ask. When I'm working on my programs at school, if I try to read from a text file, it can't seem to find the text file. However, if I run the exact same thing on … | |
hey there! ok i need help figuring out what is wrong with my code. i have to write a program that does addition and subtraction in stacking. but all im getting is error. some advice would be greatly appreciated thanks here is the code #include <iostream> #include <stack> #include <string> … | |
Okay, I figured out the larger problem that I've been having with my program, now all I need is it to get out of the loop and finish the program. Well, it won't break out for some reason. Anyone see why? [code]row = col = 4; z = 0; do … | |
I'll try to explain. I've got a C++ program that is going to copy files from it's folder which it is located in to another location. So, I'd say f.x. I had a directory called "Flash". Then, inside that directory would be "myprogram.exe" and 4 other directories. Within those 4 … | |
Ended up solving it don't know how delete post however [code] include <iostream> using namespace std; /* * linkedlist.h * linkedlist */ struct node { int data; node * next; }; class linkedlist { node * hd; public: linkedlist(){ hd = NULL; } void add_to_end(int data) { //find end of … | |
I need a complete help on how to use the flush() member function with ofstream, ifstream and fstream and also its use. P.S: Please provide an example for me to understand | |
Well, I bumped into an interesting C++ problem last night while I was aimlessly surfing the Internet, and, of course, it caught my attention. It said something like this: "From a file it's read a text that contains a phrase, on a line. The program rearranges the letters in each … | |
[code] /* * File: sets.cpp * ------------------ * This program deals with sets of lower case letters. * This program computes the union and intersection of two sets. This program * also checks if set B is a subset of set A and returns true if set B is a … | |
am just a beginner and an getting the compiling error like:(warning: no newline at end of file) anyone who could help me out? [code=cplusplus] #include <iostream> #include <cmath> using namespace std; int main(){ int a; int b; int c; double p; double x1; double x2; cout<<"bitte lesen sie vier nummern … | |
Hi, I'm implementing linear block coding and need some ideas on how to go about storing the cosets. i.e. If i have an alphabet C={000,101,010,111} I need to perform C+000={000,101,010,111} C+001={001,100,011,110} C+010={010,111,000,101} C+011={011,110,001,100} etc... observed here is that there are only 2 sets and it keeps repeating.So, i need to … ![]() | |
HI i have a small problem but for some reason i can't think of how to do it. I'm making a linear linked list of arrays. The Array is of travel class object. So in the struct node, how should i implement so that the size of the array is … ![]() | |
Hi all I urgently need a tool that either convert java code to c++ or make reverse engineering diagrams of java code..like uml/sequence digs..etc…or explanation of the code…. If anyone have idea of such a tool then let me know please. Regards | |
My assignment is to take in values that will create a maze, and then let the user traverse the maze by use of a stack to store values. I thought I had it down to it working, but now it isn't doing what it should and then it stops after … | |
You are supplied with a group of implemented sorting algorithms (posted file sortTest.cpp). You may not change the prototypes or any of the provided code. You will add a main program to use the functions you are given. You will also add one additional function VerirySorted. This function will take … | |
Hi guys im getting some errors here and cant seem to find why? [code] #include <iostream> #include <iomanip> using namespace std; class Student{ public: Student (Mary, 100, 99, 88, 1); void getInfo(); void showInfo(); private: string name; double test1, test2, test3; int idNum; }; Student::Student (string n, double t1, double … | |
i am programming in microsofts visual C++ forms program i am a very beginner. lol but i have the main design that i want but. i would like to add functionality to the url box, the go button, and the forward and backword buttons. could somebody please help me i … | |
[CODE=cplusplus]// CS 210 EDDIE CHEN // THIS IS PROGRAM 4 (ISBN-Check), a program that verifies ISBN. #include <iostream> #include <fstream> // REQUIRED FOR FILE STREAMS #include <cstdlib> // FOR DEFINITION OF EXIT_FAILURE #include <cctype> #include <string> using namespace std; // ASSOCIATE STREAMS WITH EXTERNAL FILE NAMES #define inFile "isbntest.txt" // … | |
Hey, im trying to print what is stored in my 2d dynmic array from a file in my print function. However whenever i try to access information in the array, it crashes the program. maybe the array is not being passed back some how, im not sure, any information would … | |
Hi if i want to say if (int <= 0 || int is not a number) how could i do this i want to make sure that a positive number is input not a negative number or word or symbol hope this makes sense | |
Well, I need to write a program that uses enumerated datatypes, structs, and plenty of functions. Below is my current code: [CODE]#include <iostream> #include <fstream> #include <iomanip> #include <string> using namespace std; void getInput(string input); void outputStudent(string student); void outputTeacher(string teacher); void outputStaff(string staff); void sendtoOutputStudents(string students); struct personDataType { … |
The End.