Starting a program

I feel like i'm falling behind my comp sci class. I need help starting a program for hwk. here's the link http://www2.cs.uh.edu/~acl/cs1410/prog6.pdf
Any help or advice would be greatly appreciated.
What are you having problems with?

The only thing that is wrong with the task description is the recommendation to use clock() - it is unsuitable for measuring time. However, if you're using Windows, you can disregard that for the moment.
I'd recommend using a std::string to store the characters for the test. You'd use rand() % 128 to generate the characters and use += to push them back into your vector. Then, you'd start a loop. At the top, you'd pause the program for 3 seconds, after which you'd take a note of the clock, permit someone to enter a number of characters + Enter, take a note of the clock again, calculate the difference in times, calculate the score, and then rerun the loop.

Does this help you start?

-Albatross
I have a question about starting a program as well...i am back in school and it has been over 10 years since i have created a program..i have an assignment due and i have no clue what i am doing..i am suppose to calculate a car's gas mileage ask them to enter the number of gallons a car can hold; the number of miles it can be driven on a full tank. then display the number of miles it may be driven per gallon of gas.....if anyone can guide me on how to begin i would be very appreciative because i really need to learn how to do this...help please!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
using namespace std;

int main()
{ 
double mileage;
double tanksize;
double distance;

cout<<"Enter mileage \n";
cin>>mileage;

cout<<"Enter tanksize \n";
cin >> tanksize;

distance = mileage * tanksize; 

cout<< distance;

	cin.ignore().get();
	return 0;
}
omg! thank you soooooooooooooooo much I have been sitting here for the past 3 days in zombie land....thank you....if i have anymore questions do u mind if i ask you?
@ AlphaBravo: We discourage posting complete homework solutions on this site. If you want to help them; help them learn, don't help them cheat.
Hardly encouraging him to cheat. Apart from hello world this would have been one of the first codes I would have written when I started learning. He's not going to get anywhere at all cheating on initial, starting codes such as these.
closed account (S6k9GNh0)
You just proved yourself an idiot. That's the whole reason why we do not post homework solutions. Give him hints, not answers. It's his class, not ours. If he doesn't want to pay attention to his class instructor, he can fail for all I give a crap.
Last edited on
And you just proved yourself a bigger idiot by not getting my point.
cout<<"LOL";
You two just proved yourselves to be idiot-callers, but I +1 computerquip's and cnoeval's posts. Give hints in C++ or hints in English or solutions in English, but not solutions in C++... please? It doesn't help them that way. :(

-Albatross
Jesus h... I have not encouraged or posted code to encourage cheating. I often found that much of my time spent searching for vague, hinted answers ended up spiralling down wrong pathways that cost time and effort which could have been curtailed by someone just showing me how the damned code was written so I could learn from it. Especially at the start of the learning process when I was struggling to get used to the syntax and the new dynamics of it all. I considered this poster so damned early in the learning process that showing how such a simple code was written was more beneficial than vague hints.

I'm guessing that to +1 another post is unrelated to name calling ..?

Last edited on
AlphaBravo wrote:
I often found that much of my time spent searching for vague, hinted answers ended up spiralling down wrong pathways that cost time and effort which could have been curtailed by someone just showing me how the damned code was written so I could learn from it.


Yes, you might have benefited from that, but we can't guarantee that others will, especially with homework problems. Other problems that aren't for-credit are safer, but we can't really tell the difference...

-Albatross
Last edited on
cout<<"Fight!! fight!!";

GODs love stupid people.. Know why?

HE made many of THEM... make sense..?
Last edited on
I didn't mean to start any trouble or ask for the answer to the homework assignment...All I wanted was a little help starting out because it has been over 10 years since I have taken any programming classes and I have forgotten how to do this and just need guidance on how to start it. Alphbravo I don't think you were helping me cheat you were just assisting someone who was a little lost...But again thanks soooooooooooooo much!!!!
closed account (SEbXoG1T)
AlphaBravo helped me so i say good job!!
Topic archived. No new replies allowed.