What's new

I want to learn some programming

Doomulation

?????????????????????????
Hmm, you did think of a few things I didn't, but I doubt you can put a new line into the buffer without pasting it. Oh and btw, I use cin.get because usually cin >> buffer stops when reading spaces. Something to remember. Therefore I use cin.get to specify how much data to read.
 

Poobah

New member
Doomulation said:
Hmm, you did think of a few things I didn't, but I doubt you can put a new line into the buffer without pasting it. Oh and btw, I use cin.get because usually cin >> buffer stops when reading spaces. Something to remember. Therefore I use cin.get to specify how much data to read.
I added the new-line check because it seems that if the text that I enter wraps to the next line, a new-line character is inserted into the buffer, and it is otherwise interpreted as "junk".
 

pegasus001

Normal User
well guys i think this exercise is kind of difficult for a begginer so i think it`s better for him to do things one step at a time and not to get confused with pointers or cin.get() things. For a better start let him enter the numbers separated by <enter>(new line) and specify a value like -50000 to stop the inputting. i think that easier for a begginer.
 

Poobah

New member
Doomulation said:
I see. Didn't know that.
Actually, I was wrong about the wrapping thing. I must have added those new line checks while changing something else, and thought they fixed whatever was causing the "encountered junk in input" problem.
 

Doomulation

?????????????????????????
pegasus001 said:
well guys i think this exercise is kind of difficult for a begginer so i think it`s better for him to do things one step at a time and not to get confused with pointers or cin.get() things. For a better start let him enter the numbers separated by <enter>(new line) and specify a value like -50000 to stop the inputting. i think that easier for a begginer.
Indeed, I most agree. However, the question was how to do it with spaces. If xneoangel will reformulate the question to inputting numbers after each other and an ENDING condition, I can rewrite the code to an easier one.
For example, quit after entering 5 numbers, etc.
 

pegasus001

Normal User
i don`t know what books is xneoangel reading about c++, but i have a few ones for the absolute beginner, coz i guess that`s what he is. A good book i gained a lot of knowledge from about c++ is "c++ interactive course". I just learned it after some good programming in paskal. It only explains about classes, inheritance etc. and everything about oop. But i think that choosing c/c++ as your first programming language language is a bit tough. These languages are so low level that you`ll end leaving it, BUT THEY ARE AWSOME(if you master the beast named c++). I am currently programming in c#. My code has some elegance now but i miss the old days. So now i`m learning the stl. I know it`s a little tough but i bet it`s worth learning.
 

civilian0746

evil god
I agree with pegasus001. choosing c and c++ as first language is indeed tough. Because the the person would have a hard time understanding whats going on. They need to start with assembly and proper programming concepts. So they an take the understanding behind those high level languages like c for granted. Of course, even higher languages like C++ and vb becomes common sense when they grasp something like c.
 

Garstyciuks

New member
I agree with pegasus001. choosing c and c++ as first language is indeed tough. Because the the person would have a hard time understanding whats going on. They need to start with assembly and proper programming concepts. So they an take the understanding behind those high level languages like c for granted. Of course, even higher languages like C++ and vb becomes common sense when they grasp something like c.

That totally depends from person who is trying to learn. I started from VB, then I learned a little of assembly programming and then C++.
 

Doomulation

?????????????????????????
I agree with pegasus001. choosing c and c++ as first language is indeed tough. Because the the person would have a hard time understanding whats going on. They need to start with assembly and proper programming concepts. So they an take the understanding behind those high level languages like c for granted. Of course, even higher languages like C++ and vb becomes common sense when they grasp something like c.
C++ IS C. Besides, assembly is EVEN harder than C or C++. Learn C/C++ first, THEN assembly. Of course, I do agree that every C/C++ programmer should know assembly, because it makes them know what goes on behind the scenes and therefore can do efficient coding and solve many of the hurdles.
 

civilian0746

evil god
How is assembly harder than c and c++? I reckon its simpler. It seems harder to someone if they are overconfident using higher level languages. But its quite plain, simple and universal. Its the ABCs of programming. People should know about assembly concepts and appreciate them before even attempting higher level languages. Its like starting to build a nuclear bomb without having any knowledge of nuclear physics. Their uncreative mind will always be full of holes and doubts and you get sick of them soon enough with all their stupid questions and problems.

Did he not say it himself that he wants to learn programming so that he can code from emus? He needs to know assembly upside down before anything else. Not only know...he needs to be an expert of assembly before he can even think about what he is trying to do. Because I doubt he will be writing emulators for ifs and elses and cins and couts and overloaded operators. Those complications don't exist in the realm he needs to be.
 

Doomulation

?????????????????????????
Learning all the opcodes isn't easy and it makes your code look messy and it's very hard to program and use it. Sure, it may be simple, but it makes everything else a pain: using jumps instead of ifs, pushing things in the right order to call a function...
And it usually is not PORTABLE.
My advice is: learn C or C++. Get aquianted with the language. Learn computer basics, such as memory and pointers. Then invest some knowledge into assembly. You probably won't write a whole program in assembly, so it isn't a key part.
 

civilian0746

evil god
lol...learning all the opcodes...nobody needs to learn all the opcodes. In assembly, they just need to learn different types so they can use them if required. Of course, that comes way way later after they have grasped all the assembly basics.

You are the one who said c and c++ are low level languages? I almost had a heartattack there when i read it. For you to say its messy and not portable, I guess you are overconfident with higher level languages as well. I don't see why its that hard. Its a pain to grasp those concepts once your mind is already corrupted with higher level shit. And you never really learn it completely after that. You feel like its a pain in the arse because you are used to lazyness on higher level languages. You feel like writing partial programs and inlining rather than writing proper code.

Of course, I am not saying he cant learn higher level languages. Of course he can. It took me less than 2 days to learn C++ including all its OO garbage. But I must admit, I spent most of that time looking up a descent tutorial that isnot full of those cin and cout garbage. I just could not bear the bit shifting operator overload hypocrisy. After that when I looked at java, the only thing i had to learn was that everything is pointers. I wonder how long its going to take for him. You still seem to be on the ABC stages. Does he feel confident enough to write real solutions? I dont think he even understood your last example all that well.
 

Doomulation

?????????????????????????
Oh please, it's obvious that you love assembly and hate everything else. Take a look around and ask expert whether they want to use assembly or C++. It's NOT garbage or crap or whatever. Many things can be MUCH, MUCH, MUCH easier in a high level language, that CANNOT be done in assembly. When working with objects, for example, you need to specify the offset.
You need to allocate data storage yourself. You need to pay heed to naming conventions (cdecl, stdcall, fastcall, etc). And so on.
C++ is NOT garbage, and assembly IS hard.
I don't want you to spout nonsense here. C/C++ IS hard, yes, and everyone needs time to learn. Can you do that in assembly without causing lots of confusion? I'd like to see you try.
 

civilian0746

evil god
You should not speak nonosense here. There is nothing that can be done with higher level languages that can't be done in assembly. Otherwise those higher level concepts wouldnot exist. But there are things in assembly that cant be done with higher level languages alone. Assembly has facilities for working with everything you mentioned there as impossible. Classes/data structures/source organization...everything. You name it. Of course, it may require you to understand what they really are. But thats about it. The motive behind higher level languages does not include being easier than assembly so that people can ignore its teachings. Most of the things on those higher level languages come from lower level assembly programming concepts. You understand asembly, you can flawlessly understand anything. I don't see how people can call somoene an expert and not a newbie who thinks assembly is hard. I can see why you think assembly is hard. You said it yourself..."learning all the opcodes." The way you went about learning it is wrong. Its not like reading a novel that you can skip to the middle and figure out how it was in the begining. I am guessing you never tried learning it because you used the word "opcode." I seriously think you are going about the wrong way here. I saw an example of DirectSound somewhere. I mean wtf. He does not even understand sound and you are preaching him DirectSound. I don't mean to be offensive but he will get bored and loose interest in programming soon enough thinking its hard.
 

Toasty

Sony battery
civilian0746 said:
People should know about assembly concepts and appreciate them before even attempting higher level languages. Its like starting to build a nuclear bomb without having any knowledge of nuclear physics.
...or like breathing without intimate knowledge of the respiratory system! What an insane idea!

I'd rather not get involved in an X vs Y argument, but I learned to program (quite well if I do say so myself) in three different languages before I ever dabbled with assembly and I don't feel I missed out on anything because of it. Object-oriented concepts always fascinated me a lot more than line after line of individual instructions. There's a very human, natural way that C-like languages handle things that is lost in assembly. Code blocks, familiar operators, names, descriptive keywords, structures - IMO these all make C-like code a lot easier to read, write and understand than assembly.
 

pegasus001

Normal User
hey people don`t get so hasty now. We are only discussing. In my opinion assembly programming is harder. Not everyone one of us likes what`s going on behind the scenes, and sometimes is better. High level languages like those oop are made to make our life(the programmers) o lot more easier. I know by myself and by other programmers friend of mine that we are a so lazy class of mammals, so why do we have to write lots of lines of code just to make this : int x = y;

By the way i`m just learning about computer architecture to begin programming my own emu, can anyone of you gus tell me sth more.

PS. I also think assembly language is cool and i want to know what goes behind the scenes and i would like that everybody likes it too.
 

Cyberman

Moderator
Moderator
If you are curious what goes on behind the scenes you should look at the back end of GCC (IE get the source and examine what produces the code that links in). Or you should be able to produce assembler source from MS compilors still.

What's really interesting in what they produce when using compilor intrensics for MMX SSE and SSE2.

Cyb
 

Top