Dear all, I have a quick question about if-else-if control flow (you'd think by now these questions would be unnecessary, but here I am): If I was told to rewrite a function that looked like this (this is an exam question so I am not asking the exact question in order to be within the honor code) [CODE] #define STUFF int My_Function(int, int); void int(main){ ... code here } int My_Function(int a, int b){ int c = 0; if( a < b) c = b; else if (b >= a) c = b; else c = STUFF; return c; } …

Member Avatar
Member Avatar
+0 forum 9

Dear All, I am running into issues integrating an image with content and automatically integrated background colors. Currently my style sheet has the following definition: [CODE]body { background:#657491 url("http://www.baylor.edu/content/imglib/144243.gif") no-repeat top; margin: 150px 10px 10px 10px; font-family: verdana, arial, helvetica, sans-serif; color: #657491; font-size: 11px; }[/CODE] When I integrate my background image with the existing content everything plays nicely until I reach the end of the image, where I transition to color #657491, which works really well for the sides. I wanted some of the image to be transparent behind the content so I faded the background image itself, which …

Member Avatar
Member Avatar
+0 forum 1

Hello All, I am trying to solve maximum flow, and I am experiencing some problems formatting the output. Here is some pseudocode I am trying to implement. c [u, v] is capacity from u to v, f [u, v] is the flow, cf [u, v] is the residual capacity. for each edge (u, v) in the graph do: f [u, v]: = 0; f [v, u]: = 0 cf [u, v]: = c [u, v], cf [v, u]: = c [v, u] While there is a path p from s to t in residual flow graph do r: = min …

Member Avatar
Member Avatar
+0 forum 1

Hello, I am trying to declare a 2D array (3x3) inside of a class. I have it set up like this: GameBoard.cpp[CODE] #include "GameBoard.h" #include <iostream> using namespace std; char board [3][3]; GameBoard::GameBoard() { board [0][0] = 'a'; board [0][1] = 'b'; board [0][2] = 'c'; board [1][0] = 'd'; board [1][1] = 'e'; board [1][2] = 'f'; board [2][0] = 'g'; board [2][1] = 'h'; board [2][2] = 'i'; } [/CODE] Game.cpp (Driver) [CODE] #include "GameBoard.h" #include <iostream> using namespace std; int main() { cout << "Let's play Tic-Tac-Toe!!" << endl << "Player 1 gamepiece is X" << endl …

Member Avatar
Member Avatar
+0 forum 5

Hello everyone, I am having some difficulty with a class assignment, partially because the professor has assigned it before we have covered the material. I have created a general case for the classes, but I really don't know what the assignment is asking me to do. Any help is appreciated, but I really need help figuring out where to go with this. A couple specific questions: 1. How do I create a destructor, and what does it do exactly (in terms of this program would be great) 2. How do I get the data from the file to alter the …

Member Avatar
Member Avatar
+0 forum 4

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 have is minimal, and I need to use iterated loops. I am having trouble, and if anyone can help I would appreciate it. This is the wiki page for Explicit stencil: (Note I am not using standard central difference) [url]http://en.wikipedia.org/wiki/Finite_difference_method[/url] Here is my code thus far: [CODE] /***************************************************************************** This program …

Member Avatar
Member Avatar
+0 forum 4

Hello everyone, I am trying to get a head start on this week's program, as it seems to be a long, albeit relatively easy, program. I wanted to double check with the experts here to make sure the flow of control for this program is correct. The assignment is as follows: [I] The ability to write functions is one of the more powerful capabilities in C++. Functions allow code to be reused, and provides a mechanism for introducing the concept of modularity to the programming process. In addition to the concept of functions, C++ allows complex programs to be organized …

Member Avatar
Member Avatar
+0 forum 1

Hello everyone, I am having a really difficult time getting this program off of the ground. I need to use a while loop to read data from a file and then read tonnage numbers corresponding to names read in from that file. The assignment looks something like this: [I]After watching the Discovery Channel’s, Ice Road Truckers, German transportation tycoon Otto Bonn is expanding his business to North America. He has been taking resumes from truck drivers through out the U.S. and Canada. He has collected a large number of files that contain the per season tonnage transported for several drivers, …

Member Avatar
Member Avatar
+0 forum 8

Hello everyone. I am trying to create a program that reads these values / strings from a file: 170 Lipstick 250 Orange Crush 350 Chickadee 450 Green Grass 550 Monaco 750 Toffee Crunch Then I am supposed to create a menu that prompts the user to provide either the number or name, then my program provides the corresponding number / name. My problem is this: It works locally on my system, which is running DOS, but does not operate properly on the Unix based upload site. I think it has something to do with the transition from input buffer to …

Member Avatar
Member Avatar
+0 forum 15

Hello everyone. I am new to coding, taking an introductory C++ class at Baylor University. I am trying to get this standard deviation problem worked out, but I just pulled an all-nighter on it thinking it would be simple, but it is not. I have attached the prompt for the assignment if you would care to take a look: [ATTACH]7290[/ATTACH] As per the code I have developed, that can be viewed here: [CODE]/************************************************************************************************************************ Filename: Assignment 1.cpp Author: Myles Daniel Baker Class: CSI 1430 - 05 Description: This C++ Porgram will accept four integers from a user, store them as variables, …

Member Avatar
Member Avatar
+0 forum 1

The End.