• Log in or sign up for an account here: https://www.sythe.org/login

C++ help

The Riddler_

Grand Master

Banned
Joined
Nov 28, 2008
Sythe Gold
0
Messages
2,779
Location
SFA
Hey, i'm using the Dev C++ compiler, and typically when I compile my code it runs movely, no erros, but when I run the programs, some of them don't do anything after the "cout's". I'll run the program, it prompts me the cout that I have, but it does nothing after that.

Here's the code.

Code:
#include <iostream.h>
#include <math.h>
#include <stdlib.h>

int main()
{
	double h;
	double t = 0.0;
	double v = 0.0;
	double s = 0.0;
	cout << "Whats is the height of the object?" << endl;
	cin >> h;
	cout << h;
	while(h > 0);
	{
		t++;
		h--;
		v = t * 32.0;
		s = t * t * 16.0;
		cout << "The volocity is " << v << ", The height of the object is " << h << 
		", and " << t << "seconds have gone by";
	}
}

Just a simple program.

Thanks.
 
Doge
I'm LAAAAAAAME
you're missing an endl; after your cout statement

Code:
cout << "The volocity is " << v << ", The height of the object is " << h << ", and " << t << "seconds have gone by" endl;
 
Could be because you forgot:
Code:
using namespace std;
After your header files.
 
Runescape Gamblingrunescape gambling
Back
Top