11 Replies - 609 Views - Last Post: 18 August 2009 - 07:05 AM Rate Topic: -----

#1 AJOHNZ  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 82
  • Joined: 10-May 09

Bragging Rights

Post icon  Posted 17 August 2009 - 08:37 PM

so yeah i just wrote this entire program without compiling til i was done writing it completely...when i compiled after i was done...0 errors. haha but seriously it felt good. that never happens to me.

#include <iostream>
#include <iomanip>
using namespace std;

double totalCharges(double, double, double, double);
double totalCharges(double, double);

int main()
{
	char choice;
	double spent, rate, meds, services; 

	cout << "Were you an in-patient or an out-patient?(Enter I or O): ";
	cin >> choice;

	if (choice == 'i' || choice == 'I')
	{
		cout << "Enter number of days spent in hospital: ";
		cin >> spent;
		cout << "Enter the daily rate: ";
		cin >> rate;
		cout << "Enter hospital medication charges: ";
		cin >> meds;
		cout << "Enter charges for hospital services: ";
		cin >> services;

		cout << "Total Charges: $" << fixed << setprecision(2) << totalCharges(spent, rate, meds, services) << endl;
	}

	if (choice == 'o' || choice == 'O')
	{
		cout << "Enter charges for hospital services: ";
		cin >> services;
		cout << "Enter hospital medication charges: ";
		cin >> meds;

		cout << "Total Charges: $" << fixed << setprecision(2) << totalCharges(services, meds) << endl;
	}

	return 0;
}

double totalCharges(double spe, double rat, double med, double serv)
{
	return (spe * rat) + med + serv;
}

double totalCharges(double ser, double me)
{
	return ser + me;
}



Is This A Good Question/Topic? 0
  • +

Replies To: Bragging Rights

#2 Ancient Dragon  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 81
  • View blog
  • Posts: 679
  • Joined: 19-July 09

Re: Bragging Rights

Posted 17 August 2009 - 08:43 PM

That is very foolish. Professional coders compile often so that they don't have to contend with billions of compiler errors all at one time. Doing that once just to see if you can do it is one thing, doing it as a matter of style is quite another.
Was This Post Helpful? 0
  • +
  • -

#3 AJOHNZ  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 82
  • Joined: 10-May 09

Re: Bragging Rights

Posted 17 August 2009 - 08:58 PM

View PostAncient Dragon, on 17 Aug, 2009 - 07:43 PM, said:

That is very foolish. Professional coders compile often so that they don't have to contend with billions of compiler errors all at one time. Doing that once just to see if you can do it is one thing, doing it as a matter of style is quite another.


haha no i normally compile often, i just wanted to see if i could do it once. it was a personal goal.
Was This Post Helpful? 0
  • +
  • -

#4 poncho4all  Icon User is offline

  • D.I.C Head!
  • member icon

Reputation: 123
  • View blog
  • Posts: 1,405
  • Joined: 15-July 09

Re: Bragging Rights

Posted 17 August 2009 - 09:52 PM

Congrats on achiving your goal!

Good job!
Was This Post Helpful? 0
  • +
  • -

#5 vwyodapink  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 141
  • Joined: 12-May 09

Re: Bragging Rights

Posted 18 August 2009 - 01:57 AM

Great job man!!

My goal right now is to get through an entire week in class without asking a single question here. And I would also like to help solve my first prog for someone else. But I would be stoked if I wrote that and got no errors compiling or not :)
Was This Post Helpful? 0
  • +
  • -

#6 Elcric  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 101
  • View blog
  • Posts: 453
  • Joined: 02-May 09

Re: Bragging Rights

Posted 18 August 2009 - 02:02 AM

:D :D :D :D :D :D :D :D :D :D :D :D :D :D :D
Congratulations!
Was This Post Helpful? 0
  • +
  • -

#7 ice-t  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 104
  • Joined: 26-May 09

Re: Bragging Rights

Posted 18 August 2009 - 02:46 AM

I tried that too once and i compiled a different file by mistake and i was soo happy when i saw 0 errors,then i saw the horror and when my file compiled , just 22 errors not that much :)).

Never did that again,always compile after a function or smth.
Was This Post Helpful? 0
  • +
  • -

#8 Kanvus  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 42
  • View blog
  • Posts: 452
  • Joined: 19-February 09

Re: Bragging Rights

Posted 18 August 2009 - 03:41 AM

very pro

to me, less than 10 errors feels like it worked already
Was This Post Helpful? 1
  • +
  • -

#9 OliveOyl3471  Icon User is offline

  • Everybody's crazy but me!
  • member icon

Reputation: 134
  • View blog
  • Posts: 6,581
  • Joined: 11-July 07

Re: Bragging Rights

Posted 18 August 2009 - 05:56 AM

Congrats, man...I guess. ;)

I don't think I've ever done that, I compile the code after most changes.
That way if there is an error that I just can't fix, I can simply undo the last change so it will compile again.
Was This Post Helpful? 0
  • +
  • -

#10 NeoTifa  Icon User is offline

  • Whorediot
  • member icon





Reputation: 2650
  • View blog
  • Posts: 15,673
  • Joined: 24-September 08

Re: Bragging Rights

Posted 18 August 2009 - 05:59 AM

I compile every other line, but grats on the 1337 coding ^____^
Was This Post Helpful? 0
  • +
  • -

#11 computerfox  Icon User is offline

  • straight vegetarian kid

Reputation: 50
  • View blog
  • Posts: 3,772
  • Joined: 29-January 09

Re: Bragging Rights

Posted 18 August 2009 - 06:10 AM

View Postvwyodapink, on 18 Aug, 2009 - 12:57 AM, said:

Great job man!!

My goal right now is to get through an entire week in class without asking a single question here. And I would also like to help solve my first prog for someone else. But I would be stoked if I wrote that and got no errors compiling or not :)



Now that is very foolish. When it comes to school, I think, if you have a question, don't be afraid to ask. I don't think that should be a goal. I think the real goal is to get better grades on assignments and help as many people as you can

As for john, congrats, that's usually how i write, but i don't really advise anyone to do it cause at the end if you have tons of errors it's difficult to debug, but if you compile something like that at least twice during the writing process, you can prevent many headaches. :)

View PostKanvus, on 18 Aug, 2009 - 02:41 AM, said:

very pro

to me, less than 10 errors feels like it worked already



<yoda>ow, he is young in coding. much you learn must </yoda>
Was This Post Helpful? 0
  • +
  • -

#12 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: Bragging Rights

Posted 18 August 2009 - 07:05 AM

Congratulations!!! I too often smile to myself when I write a good amount of code and it compiles fine. Often I get irritated when I realize that I have not compiled in a while because I think to myself, "oh crap, here come the compiler errors".

Actually though, a good IDE can help greatly by checking many basic things for you as you type. Learning to use the shortcuts in your IDE (such as code completion, and inline documentation) can greatly improve productivity. There may also be plug-ins available that help above and beyond what the IDE does by itself. For example I like my little script that looks up classes on cplusplus.com for me.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1