I am trying to write a function that will compute GPA. [CODE]#include "Student.h" #include "ClassInformation.h" Student* setupStudent(){ string f,l,idNo; double gPoint=0; Student *studPtr1; studPtr1 = new Student (); cout<<"Enter first name "; cin>>f; studPtr1->setfirstName(f); cout<<"Enter last name "; cin>>l; studPtr1->setlastName(l); cout<<"Enter A number"; cin>>idNo; studPtr1->setaNumber(idNo); cout<<endl; studPtr1->setGPA(gPoint); return studPtr1; } ClassInformation* setupClassInformationArrary(int *length){ int *maxClasses; ClassInformation *classInfo; classInfo = new ClassInformation[*maxClasses]; return classInfo; }; void readClassInformation(ClassInformation*singleGlass){ string cName; int cNumber,h; char g; cout<<"Enter class name "; cin>>cName; singleGlass->setclassName(cName);//change these lines cout<<"Enter class number"; cin>>cNumber; singleGlass->setclassNumber(cNumber); cout<<" Enter credit hours "; cin>>h; singleGlass->setcreditHrs(h); cout<<"Enter student's letter grade"; cin>>g; singleGlass->setletterGrade(g); }; void …

Member Avatar
Member Avatar
+0 forum 7

First of all, this is not schoolwork but rather me trying to read about c++ and through program examples and see if I can write my own. So help is much appreciated if you could as I am a new learner. This program that I am writing is supposed to look through words in a paragraph and if it fits the equation it adds it to the string otherwise the program resets. I have written a pseudo-code for this program. Now I am trying to implement what I wrote into c++ code form. I am new to programming and forgot …

Member Avatar
Member Avatar
+0 forum 5

I am a beginner in MIPS and we're given this assignment to write a programs in MIPS to convert binary string to decimal i do some research and I found some helpful information: TO convert a binary number to decimal Let X be a binary number, n digits in length, composed of bits Xn-1 ... Xo Let D be a decimal number Let i be a counter 1. Let D = 0 2. Let i = 0 3. While i < n do: If Xi == 1 (i.e if bit i in X is 1), then set D = (D …

Member Avatar
+0 forum 0

[B]****Output[/B] There were 305 birds in this list. Species: Snow_Goose Number: 305 There were 567 birds in this list. Species: Canada_Goose Number: 567 There were 4 birds in this list. Species: Tundra_Swan Number: 4 There were 31 birds in this list. Species: Wood_Duck Number: 31 There were 60 birds in this list. Species: Gadwall Number: 60 There were 143 birds in this list. Species: American_Wigeon Number: 143 Press any key to continue . . . [B] ***How would I make a loop so that it would add up all the numbers of birds and species from the text file. Right …

Member Avatar
Member Avatar
+0 forum 6

In the function largest, it works correctly for numbers greater than 2 such as 3, but does not give me the correct results for numbers 1 and 2 when entered. How would I fix this. [CODE]#include <iostream> #include <cmath> #include <iomanip> #include <fstream> #include <string> using namespace std; int nexta(int a); int enter(int& a, string filename); int evenodd(int h, int& even, int& odd); int calculator(int a, string filename); int largest(int a, int& j, int& y, int k); int countSequence(int n); int continueCalc(); void howMany(); void printInfo(); int main () { //static int count = 0; string filename; bool redo = …

Member Avatar
Member Avatar
+0 forum 7

How do I change it so that it will only say how many times the program has ran once I typed another key then [B]y[/B]. Output: ================================= Programmer Name: Peter Langlands Program 3 Description: CS 150 Spring 2011 Lab CRN: Date: ================================= Enter an nonnegative number: 10 a0 = 10 a1 = 5 a2 = 16 a3 = 8 a4 = 4 a5 = 2 a6 = 1 The integer k such tha a_k = 1 is: The sum of the series equals: The largest number of the sequence is: The largest number in the sequence is in position: There …

Member Avatar
Member Avatar
+0 forum 9

How would I make this program that it tells me the number of odds or evens. I only have 1 number at the time, so I need it to either say 1 odd or 1 even. [CODE]#include <iostream> #include <fstream> using namespace std; void printInfo(); int nonNegative(int a, int k); int nexta(int a); void initialize(int& oddCount , int& evenCount); void getx(int& a); int main() { int count; int num; int zeros; int odds; int evens; int a, k; k = 0; char choice = 'Y'; ofstream outFile; //---------------------------------------- // Call function tagReader with tags1.txt outFile.open("Langlands.txt"); outFile.close(); printInfo(); nonNegative(a, k); initialize(odds, …

Member Avatar
Member Avatar
+0 forum 1

I do not know why when I compile it, on why does the last cylinder file print out multiple times int tags1 and tags2. I bolded them so you would see what I am talking about. Could someone please help me out? [CODE]#include <iostream> #include <fstream> #include <iomanip> #include <string> using namespace std; // function prototypes void tagReader ( ifstream& inFile, int&count); void getEmployee ( string& who, double& rate, int &hours ); double paycheck (int hours, double rate); void repeater ( string word, int num); bool valid (int val); void header (); //========================================================= int main() { int count = 0; …

Member Avatar
Member Avatar
+0 forum 17

I got the first function tagReader to work, but how do I get the program to read the other functions such as getEmployee, paycheck, repeater, valid, and header. Here is all I get for the output: Results from tags1.txt : Cylinder: bsharkdata 1782 12.00 82.90 Cylinder: ftmyersfeb 7150 11.00 32.89 Cylinder: sandiego99 8800 15.20 52.76 Cylinder: turtles666 2180 11.00 14.09 Cylinder: turtles765 4223 11.90 17.10 Cylinder: FredsFish 4145 11.60 42.22 Cylinder: GreatBaReef 8673 10.00 11.40 Cylinder: VaBch77June 1111 13.50 44.00 File tags1.txt had 8 data items. Results from tags2.txt : Cylinder: turtles686 2110 14.88 65.19 Cylinder: turtles995 1123 61.60 77.17 …

Member Avatar
Member Avatar
+0 forum 1

I do not know how to write a function for this. I have written just the base line of the code, but I do not know how to finish it. Here is the description. A void Function tagReader inputs the data collected by the cylinders; it has two parameters: the input file and an int count. The function inputs names, serial numbers, and location coordinates from the input file. The input file will have a descriptive name, an integer serial number and two double values representing map coordinates separated by blanks on each line. For each cylinder, echo print to …

Member Avatar
Member Avatar
+0 forum 10

I need help with this program. I do not know how I would calculate to find out the gallons as well as the cost as pictured in my output. How would you do this? Here is my output: For each student, you will get the gallon of paint Input the length: 5 Input the width: 4 Input the cost of a gallon: $5.50 It will take 0 gallon(s) to paint an area of 5 square feet at a total cost of $0.00. Press any key to continue . . . [ICODE]#include <iostream> #include <iomanip> #include <string> using namespace std ; …

Member Avatar
Member Avatar
+0 forum 11

After your program works correctly for one student, add a loop so the user can process any number of students. Prompt the user for the number of students to process; use that value to control the loop. *How do I prompt the user for the number of students to process and use that value to control the loop. [ICODE] #include<iostream> #include <string> #include <cmath> using namespace std ; string getName (); int averageScores( int); void printMessage (string, int); void tallyScores ( int,int&,int&,int&); int main() { const int NUMBER = 4; // number of scores for each student char moreStudents = …

Member Avatar
Member Avatar
+1 forum 9

I can not seem to figure out how to drop the lowest score. When I run it it says the lowest score dropped was 0. How do I fix this? [CODE]#include<iostream> #include <string> #include <cmath> using namespace std ; string getName (); int averageScores( int); void printMessage (string, int); void tallyScores ( int, int&,int&,int&); int main() { const int NUMBER = 4; // number of scores for each student char moreStudents = 'y'; string who ; //name of the student int testAverage ; cout << "For each student, you will be prompted for a name and "<< NUMBER << " …

Member Avatar
Member Avatar
+0 forum 10

I really need help in writing this program for homework. 1. Round the average for each student to the nearest integer. 2. Add code to print out an appropriate message for each student. (given in prologue comments) 3. Add code to calculate the highest student average, and the lowest student average. 4. Add code to determine the number of students in each message category.. 5. At the conclusion of the while (inData) loop, print out the number of students processed, the highest student average, the lowest student average, and the number of students in each message category. This is what …

Member Avatar
Member Avatar
+0 forum 1

Could you please tell me how to arrange my code so that the invalid statement like in my displayed output will only show up if some enters a wrong character. Here is my code: #include <iostream> #include <fstream> #include <iomanip> #include <cmath> using namespace std; int main() { //(1) Declare some variables to work with char fare; char choice='Y'; int hrIn, minIn, hrOut, minOut; int hours; int minutes; int total_minutes; int additionalTime; double cost; double charge; while(choice=='Y'||choice=='y'){ //(2) Output read info and user message cout << "\nThis program will calculate a single, couple, or group " << "\nfare amount which …

Member Avatar
Member Avatar
-1 forum 1

#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; float additionalTime; while(choice=='Y'||choice=='y'){ cout << "\nThis program will calculate a single, couple, or group " << "\nfare amount which is then owed by the customer for the trip.\n" << "\nTo calculate a single fare amount, input S (or s)" << "\nTo calculate a couple fare amount, input C (or c)" << "\nTo calculate a group fare amount, input G (or g)" << " \n\nInput S, C, or …

Member Avatar
Member Avatar
+0 forum 2

Here is my code: #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; float additionalTime; while(choice=='Y'||choice=='y') { cout << "\nThis program will calculate a single, couple, or group " << "\nfare amount which is then owed by the customer for the trip.\n" << "\nTo calculate a single fare amount, input S (or s)" << "\nTo calculate a couple fare amount, input C (or c)" << "\nTo calculate a group fare amount, input G (or g)" << " \n\nInput …

Member Avatar
Member Avatar
+0 forum 2

Please Help Me! I cannot figure out what to do. I get an error that I don't understand. I posted my code and error below: #include <iostream> #include <string> #include <iomanip> #include <cctype> using namespace std; //prototypes int read_dials(char &d1, char &d2, char &d3, char &d4, char &d5, char &d6, char &d7, char &d8); int todigits(char &d); void acknowledge_call(char d1, char d2, char d3, char d4, char d5, char d6, char d7, char d8); int main() { int read_dials(char &d); char returnValue = 0; while (returnValue != -5) { switch (returnValue) { case -1: cout << "ERROR - An invalid …

Member Avatar
Member Avatar
+0 forum 5

Hi I ahve this code which is working on Chrome, Firefox and Safari But Its not working on IE Can any one help me <html> <script type="text/javascript" language="javascript"> function set_padd(){ var tt = document.getElementById("span_padding").innerHTML; var txt = new Array(); txt = tt.split("<br>"); var atxt = ''; for(var i = 1; i < txt.length;i++){ if(txt[i].length > 0){ atxt += '<a class="padd_txt" >'+txt[i]+'</a><br />'; } } document.getElementById("span_padding").innerHTML = atxt; } </script> <style type="text/css"> .padd_txt{padding:7px;background:#009;color:#FFF;line-height:26px;font-size:14px;} </style> <body onload="set_padd();" style="font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; font-size:24px; line-height:1.2em"> <div style="width: 350px;"> <p> <span id="span_padding" style="background-color: #009; color: #FFF;" class="blocktext">This is what I want to <br /> …

Member Avatar
Member Avatar
+0 forum 2

I do not often visit the Java forum, because I know nothing worth posting in the Java forum :) But when I [I]do[/I] visit, I see a lot of posts with code without code-tags. This makes the code nearly unreadable and reduces the overall quality of Daniweb. So I have a request: When you see a post without code-tags, please use the "flag bad post" link that you can see on every post. This alerts a moderator (me for example) which can then fix the tags. If you don't know how code-tags work, it's very easy. 1. Press the [noparse][code][/noparse] …

Member Avatar
Member Avatar
+0 forum 3

The End.