Forum: C++ Nov 30th, 2006 |
| Replies: 10 Views: 3,699 Okay I get this to compile, but I must not be converting the file to 'theFile' correctly, because when I enter the file name it just hangs. What have i got wrong?
#include <iostream>
#include... |
Forum: C++ Nov 29th, 2006 |
| Replies: 10 Views: 3,699 Hmm, I am supposed to use a two dimensional array, which of course I'm not sure how to do except i need to use ascii maybe? |
Forum: C++ Nov 29th, 2006 |
| Replies: 10 Views: 3,699 It is part of what else I have to do, such as capitalize the first letter. I was hoping to get the alphabetical part right, but obviously I was wrong.
Can I use:
while (theFile >> aSong)
{... |
Forum: C++ Nov 26th, 2006 |
| Replies: 10 Views: 3,699 Hmm, how would i use isalpha(aChar) ?
like:
int main()
{
char theFile[SIZE];
ifstream userData;
cout << "Please enter a file name: " << endl; |
Forum: C++ Nov 26th, 2006 |
| Replies: 10 Views: 3,699 Okay still need help then alphabetizing the input. We didn't really go over this, and I couldn't find much in the text. How do I organize the input alphabetically? |
Forum: C++ Nov 26th, 2006 |
| Replies: 11 Views: 5,795 How do I remove extra spaces in between? |
Forum: C++ Nov 26th, 2006 |
| Replies: 10 Views: 3,699 Hmm,
Think I figured it out, and yes i have to use an array not string:
const int SIZE = 50;
int main()
{
char theFile[SIZE];
ifstream userData;
cout << "Please enter a file name:... |
Forum: C++ Nov 26th, 2006 |
| Replies: 10 Views: 3,699 How do I read data such as song titles from a file and store them in an array?
I have:
const int SIZE = 50;
int main()
{
char theFile[SIZE];
cout << "Please enter a file name: " << endl;... |
Forum: C++ Nov 17th, 2006 |
| Replies: 11 Views: 5,795 Not sure how to output using a loop? Can you show me please? |
Forum: C++ Nov 17th, 2006 |
| Replies: 11 Views: 5,795 im trying to take user input in the form of a sentence putting it in an array and then print out changes: Capitalize the first letter, then the rest of the letters are lower case. If there are... |
Forum: C++ Nov 17th, 2006 |
| Replies: 11 Views: 5,795 How do i use the function isspace to take sentences read into an array and make multiple spaces only one space between words? Use an if statement?
if (isspace(aChar) )
cout << aChar;
else... |
Forum: C++ Nov 16th, 2006 |
| Replies: 3 Views: 3,215 I think I can skip 1 for now. I coded 2 but I think I put it with section.h when it may need to go in section.cpp at the bottom as a single function. Also, not sure how to read in the scores and... |
Forum: C++ Nov 16th, 2006 |
| Replies: 3 Views: 3,215 I need help figuring this out. What I need is this:
The section number, as a string
The instructor's name, also as a string
The number of students in this section, as an integer.
The... |
Forum: C++ Nov 15th, 2006 |
| Replies: 1 Views: 1,544 i need a function: readData() to read in scores from a file.
I can open a file up, but not sure how to code it so input from the user opens any file.
int readData()
{
cout << "Please enter... |
Forum: C++ Oct 31st, 2006 |
| Replies: 9 Views: 2,895 Thanks for the help! I learned a lot! |
Forum: C++ Oct 31st, 2006 |
| Replies: 9 Views: 2,895 Okay almost done. According to the sample output:
The value of the counter is I put this in the Counter::display() function but it still only outputs Count...
void Counter::display()
{
... |
Forum: C++ Oct 31st, 2006 |
| Replies: 9 Views: 2,895 Thanks for the help so far. Something's wrong with my switch statement. It just goes to default , which is invalid selection then exits. What do I need to change?
Also i need to submit a... |
Forum: C++ Oct 30th, 2006 |
| Replies: 9 Views: 2,895 Not sure where to put these. I put them here but get errors:
#include "counter.h"
using namespace std;
int main()
{
Counter(); |
Forum: C++ Oct 30th, 2006 |
| Replies: 9 Views: 2,895 What I am trying to do:
Does the class object go in the header file or is it okay here? What do I put in the header file? What I have so far, which is incomplete, but I want to see if I'm on the... |
Forum: C++ Oct 27th, 2006 |
| Replies: 4 Views: 1,319 Ahh thanks. I was thinking I had to keep theValue variable. |
Forum: C++ Oct 26th, 2006 |
| Replies: 4 Views: 1,319 Hmm After I added the () I get:
wksht.cpp:9: error: `int MyInt::theValue' is private
wksht.cpp:62: error: within this context
wksht.cpp:62: error: `num1.MyInt::theValue' cannot be used as a... |
Forum: C++ Oct 26th, 2006 |
| Replies: 4 Views: 1,319 In the following code, how do I change the line under
cout << "\nThe value of bogus in num1 is " << num1.bogus;
to get it to compile correctly. I know its calling for theValue which is private.... |
Forum: C++ Oct 26th, 2006 |
| Replies: 11 Views: 2,226 Figured it out, :D Thanks to all !!! |
Forum: C++ Oct 26th, 2006 |
| Replies: 11 Views: 2,226 Thanks all for the help. I am almost there. Something's wrong with my calculation. I should be getting values of -15.etc -19.etc -21.etc, so something's wrong with my equation. Can someone straighten... |
Forum: C++ Oct 26th, 2006 |
| Replies: 11 Views: 2,226 Thanks I got it to work, but I'm not reading in the data from the file correctly. It looks like:
5 20
5 30
5 40
So I should be reading in only 3 lines for 3 calculations. The 5 is the... |
Forum: C++ Oct 26th, 2006 |
| Replies: 11 Views: 2,226 I now have:
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
using namespace std; |
Forum: C++ Oct 25th, 2006 |
| Replies: 11 Views: 2,226 What I'm trying to do:
Attempt to open the file. The filename, c:\\windData.txt, should be hardcoded into your program. Note the two slash characters in the file name. If the file cannot be opened,... |
Forum: C++ Oct 25th, 2006 |
| Replies: 11 Views: 2,226 Hi all,
I need help turning this:
W = 35.74 + 0.6215t - 35.75 (v0.16) + 0.4275t(v0.16)
into code. I guess the real problem is the how to turn v to the .16th power using this function:
... |
Forum: C++ Oct 20th, 2006 |
| Replies: 19 Views: 8,779 Thank you!!!!!!!!!!! Much appreciated! :D
What makes the program stay open, the cin.get()? |
Forum: C++ Oct 20th, 2006 |
| Replies: 19 Views: 8,779 Oh sorry.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main( )
{ |
Forum: C++ Oct 20th, 2006 |
| Replies: 19 Views: 8,779 Hmm, also, my executable doesn't stay open when i run it. Runs fine in my compiler, but won't stay up when running alone. |
Forum: C++ Oct 20th, 2006 |
| Replies: 19 Views: 8,779 while (theFile >> number )
{
for (count == 0; count < 100; count++)
score += number;
//count++;
if (number > max)
max = number;
... |
Forum: C++ Oct 20th, 2006 |
| Replies: 19 Views: 8,779 Okay almost got it, but having trouble with that zero showing up for min still? i know to set count == 0 but not sure what else |
Forum: C++ Oct 20th, 2006 |
| Replies: 19 Views: 8,779 All that should be in the while loop? I am getting errors now. I need to cout the max, min , and avg. What I have:
cout << "\nThe values were " << "Avg: " << average << "High: " << max << "Low: "... |
Forum: C++ Oct 20th, 2006 |
| Replies: 19 Views: 8,779 Okay I have this but its not working:
int max = 0;
int min = 0;
score += number;
count++;
if (score > max)
max = score;
if (score < min)
... |
Forum: C++ Oct 20th, 2006 |
| Replies: 19 Views: 8,779 Hmm maybe a push in the right direction? Do I need a 2nd loop or just something like:
MAX = (score > number) ? |
Forum: C++ Oct 20th, 2006 |
| Replies: 19 Views: 8,779 I need to read all scores in a file then
I am to:
The average score is simply the sum of all of the scores in the file, divided by the number of scores in the file. To find the average we just need... |
Forum: C++ Oct 20th, 2006 |
| Replies: 19 Views: 8,779 What do I need to gather all lines of numbers say 88 on one line, and 92 on the second and so on?
I have:
ifstream theFile("grades.txt");
theFile >> sc1 >> sc2 >> sc3;// this gives me each... |
Forum: C++ Oct 19th, 2006 |
| Replies: 7 Views: 1,610 Wanted to say thanks! I did follow the logic all the way through and it was frustrating to see how close I was :). Thanks again! |
Forum: C++ Oct 18th, 2006 |
| Replies: 7 Views: 1,610 It's getting near the deadline and I can't figure it out: I am to use two different functions using the same name, and then pass the variables by value and by reference and NOT use pointers.
... |