Try the code without the bell and see if it works, it should.
Printable View
Try the code without the bell and see if it works, it should.
Really?? Hmmm... It doesn't always freeze my computer, just sometimes, like it has when I make modifications and run it for the first time with the new modifications, and after it freezes once, it won't freeze anymore until I do something else to the code. But that does make sense, I'll try it!
Thanks!!!:)
***EDIT***
This is my code now, without the terminal bell and with more comments:
int main()
{
int a;
int i, j, p, c;
float x, d;
i = 40; // average working man works 40 hours a week
j = 4; // 4 weeks in a month
p = 12; // 12 months in a year
x = 0.33; // 30 percent federal tax plus 3 percent stat tax for illinois
cout << "What is your hourly wage?" << "\n";
cin >> a; //Get's the user input
c = a * i * j * p; // user input multiplied by the variables
d = a * i * j * p * x; //this is to get the amound deducted by tax
d = c - d; //this is the the yearly salary after tax is deducted
cout << "Based on your hourly wage, and assuming you work in illinois, your yearly salary is: " << d << "\n";
system("PAUSE");
return 0;
}
I code in C, C++, Perl, Java, C#, Python, Lua, SQL, Visual Basic, etc....
Any of the above languages are fine to pick up (except lua which sucks) as a beginning language. When deciding what language you want to learn you need to pay less attention to peoples opinions (most opinions on the subject are not very informed) and more attention to what type of work you want to do with the language in question.
And even then, the language is not as important as picking up good programming practices. If you need suggestions on books on any of the languages/topics I've mentioned just hit me with a pm.
Speaking of C++ does anyone know any good websites that have reasonably challenging C++ programming projects or exercises that revolve around the advanced conecpts of C++ (STL, templates, namespaces ) ??
I couldn't agree more. If you can program in one language, you can pretty much program in any other language. Of course that is a generalisation, however, the fundamentals of programming are common to each language, just implemented differently sometimes.Quote:
Originally posted here by Juridian
I code in C, C++, Perl, Java, C#, Python, Lua, SQL, Visual Basic, etc....
Any of the above languages are fine to pick up (except lua which sucks) as a beginning language. When deciding what language you want to learn you need to pay less attention to peoples opinions (most opinions on the subject are not very informed) and more attention to what type of work you want to do with the language in question.
And even then, the language is not as important as picking up good programming practices. If you need suggestions on books on any of the languages/topics I've mentioned just hit me with a pm.
It is a bit of "Horses for courses!" though, the right choice depends on what you wish to accomplish.
I personally like C - it has the structure of a high level language coupled with the ability to access hardware registers and memory directly, as you would in assembler or machine code. I would suggest that is the reason it is popular and has been around for a while.
hi The Duck
Not to be too Critcal ...............Comments are good no doubt .........but you have just too many :p .........you have to work on the naming of the variables too.....These a, e, i , o , u are good but in the long run they become a headace..........Try Choose a name which is short, simple and defines it's purpose..........Variable name is as important as comments and increases readibility.........it will be immensly helpful in long programs............rest is good .
Cann't Comment on Dev C++ 4 compiler never used it..........i have always worked on Turbo C++.......But the Freezing as you are Discribing might be something to with the compiler messing up.........If it's happening with every Progaram..........Try Unstalling and reinstalling the DEV C++.Quote:
It doesn't always freeze my computer, just sometimes, like it has when I make modifications and run it for the first time with the new modifications, and after it freezes once, it won't freeze anymore until I do something else to the code. But that does make sense, I'll try it!
And regarding the First Language..........In my view ......C is a good first launage......It's Structured induces good programming practices or should i say force good progamming practices :p .........it is as simple as it can get and It can be as confusing as it can get ..
C++ would be my second Choice........Once you get the feel and touch of objects and classes and various other OOP concepts it will help you immencly with many more things ..........Every thing seems to be moving towards OOPS be it Programming languages , Databases etc etc.....
But these are my personal Choices.....any Programming could and should do........in the begnning it's about Logic Building.......learning good progarmming practives...more that the language itself.......For that any language will do. ......execpt for a few exceptions ( VB is one )
--Good Luck--
Thanks for the encouragment and support! I will stick with C++ no matter what. Hopefully, in about a year, I will be ready for OOP, Who knows, maybe less then a year. I do have a question though: Why is it that people choose C over C++? Can't C++ do everything C can do but more?
HI
hmmm ........i have heard this numurus times........people tent to view C++ as and enhansment or a higher verson of sorts of C because the name says C++ ;).........
Don't get Confused..........View them as Two Different languages........ Actually C++ is a separate language in its own right that shares a lot with C.
#C Follows Structured Programming.
#C++ Object oriented.
And thats a huge Difference in itself........the very concept is different....apart form some smaller differences......don't view then as one
And choosing C over C++ don't know about that ...that might be a personal Choice..like choosing pearl or java over C++........what i meant in my previous post was as a first language.......
What can be Done in C++.......... can also be done in C.Quote:
Can't C++ do everything C can do but more?
My Advice too is Stick to C++ it's a Good Solid Object Oriented Programming Language.......Good For Logic Building........and understanding OOPS.
--Good Luck--
Well, if C can do everything C++ can do, then what can C do that C++ can't? I mean, C++ is used for a lot of things, making applications, making games, even making exploits lol...
in syntax, c and c++ merely the same.. except for cout<< and printf("") things and several others.. and the main difference between them is that you code c in structured way, c++ in OOP.
you can do everything in c with c++. even c++ compiler give u the freedom to code in c syntax..
c++ is good to start OO..