also when you said pure did u mean so i cant use javascript because other wise u r corect i canot do it with html but i can do it with javascript using html

>also when you said pure did u mean so i cant use javascript
Javascript is a separate language from HTML. By 'pure HTML' I mean no tools or languages that extend the power of HTML. Just the HTML 4.0 specification and a conforming browser.

>other wise u r corect i canot do it with html
Bingo. :)

>but i can do it with javascript using html
Javascript is a turing complete programming language. Theoretically it can do anything.

cool thanks for clarifing me

>The << and >> operators are not interchangeable. You also have a few other syntax errors and unnecessary stuff that can be removed:

#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
  int a,b,k;
  cout<<"enter 1,2,or 3";
  cin>>k;
  cout<<"enter 1,2,or 3";
  cin>>b;
  a=k+b;
  cout<<endl<<a;
  system ("pause");
}

You do realise that in C++, the main function, when an integer, expects a return value. So you shouldn't snip off the "return 0;" part. (though it won't cause your program to not run, you'll just get a warning during compilation).

Hence, the code would be

#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
  int a,b,k;
  cout<<"enter 1,2,or 3";
  cin>>k;
  cout<<"enter 1,2,or 3";
  cin>>b;
  a=k+b;
  cout<<endl<<a;
  system ("pause");
  return 0;
}

If you don't want to return a value in main(), declare main() as void.
void main()

or

int main(void)

If you don't want to return a value in main(), declare main() as void.
void main()

main MUST ALWAYS return an int. void main() is never ever acceptable, even though some ancient compilers such as Borland's Turbo C, might not complain and despite the many examples you will see on MSDN. Current standards require main to return an int, and say it is not necessary to return 0 at the end of main().

>You do realise that in C++, the main function, when an integer, expects a return value.
As a matter of fact, I'm quite familiar with that rule and all of the details that go along with it. Are you?

>So you shouldn't snip off the "return 0;" part.
In standard C++, if you fall off the end of the main function, 0 is returned implicitly. When I'm writing pre-standard C++, the rules for C89 apply and you're correct. But I'm not, so you're not. I would appreciate not being incorrectly corrected, so you would best do your research before asuming that I've made a mistake.

>If you don't want to return a value in main(), declare main() as void
This proves that you're not yet qualified to correct me on technical details of the C++ standard. void main is:

1) Non-portable on a hosted implementation that explicitly allows it.
2) Undefined on a hosted implementation that does not allow it.

At least one very common implementation doesn't allow void main, so your suggestion is very poor. Even on implementations that allow it, void main buys you *nothing*, especially in standard C++ where it doesn't even save you keystrokes.

>int main(void)
This is also a matter of style. C++ doesn't require empty parameter lists to be designated by void.

>void main() is never ever acceptable
It's perfectly acceptable on a freestanding implementation. The rules we refer to when talking about main are exclusive to hosted implementations.

commented: That is what I am learning in my courses. +1

>void main() is never ever acceptable
It's perfectly acceptable on a freestanding implementation. The rules we refer to when talking about main are exclusive to hosted implementations.

what do you mean by "freestanding implenentation"? some embedded systems where there may not even be a main() function ? I doubt there are may people in the whole world who program in that kind of an environment. And I don't think the c standards apply there anyway.

>what do you mean by "freestanding implenentation"?

In a freestanding environment (in which C program execution may take place without any benefit of an operating system), the name and type of the function called at program startup are implementation-defined. Any library facilities available to a freestanding program, other than the minimal set required by clause 4, are implementation-defined.

>some embedded systems where there may not even be a main() function ?
True. I'd say that would be rare even for a freestanding implementation.

>I doubt there are may people in the whole world who program in that kind of an environment.
There may not be a lot of us, but there are a lot of us.

>And I don't think the c standards apply there anyway.
Most of it does; the smaller library support is not to be confused with the whole language.

[edit]Looking up "clause 4" per C90:

A strictly conforming program shall use only those features of the language and library specified in this Standard. It shall not produce output dependent on any unspecified, undefined, or implementation-defined behavior, and shall not exceed any minimum implementation limit.

The two forms of conforming implementation are hosted and freestanding. A conforming hosted implementation shall accept any strictly conforming program. A conforming freestanding implementation shall accept any strictly conforming program in which the use of the features specified in the library section is confined to the contents of the standard headers <float.h>, <limits.h>, <stdarg.h>, and <stddef.h>. A conforming implementation may have extensions (including additional library functions), provided they do not alter the behavior of any strictly conforming program.

A conforming program is one that is acceptable to a conforming implementation.

An implementation shall be accompanied by a document that defines all implementation-defined characteristics and all extensions.

>You do realise that in C++, the main function, when an integer, expects a return value.
As a matter of fact, I'm quite familiar with that rule and all of the details that go along with it. Are you?

>So you shouldn't snip off the "return 0;" part.
In standard C++, if you fall off the end of the main function, 0 is returned implicitly. When I'm writing pre-standard C++, the rules for C89 apply and you're correct. But I'm not, so you're not. I would appreciate not being incorrectly corrected, so you would best do your research before asuming that I've made a mistake.

>If you don't want to return a value in main(), declare main() as void
This proves that you're not yet qualified to correct me on technical details of the C++ standard. void main is:

1) Non-portable on a hosted implementation that explicitly allows it.
2) Undefined on a hosted implementation that does not allow it.

At least one very common implementation doesn't allow void main, so your suggestion is very poor. Even on implementations that allow it, void main buys you *nothing*, especially in standard C++ where it doesn't even save you keystrokes.

>int main(void)
This is also a matter of style. C++ doesn't require empty parameter lists to be designated by void.

>void main() is never ever acceptable
It's perfectly acceptable on a freestanding implementation. The rules we refer to when talking about main are exclusive to hosted implementations.

I did not, for one moment, doubt your proficiency in the C language. I suggested what I did as per what we'd been taught in college. We're using Borland Turbo C compilers (antiquated, I know), and those do give a warning when the main() function does not return a value.

The points you mentioned were indeed enlightening and show that I have a long way to go before I can skillfully use the language.

I was wondering, what compiler do you suggest I ought to switch to? Is there one that supports the standard C++ implementation?

Thanks

>what compiler do you suggest I ought to switch to?
Dev-C++ is usually a good choice.

You're wrong (sorry). HTML is a markup language - it deals with PRESENTATION only. There is no real concept of Data or Data manipulation until you move into scripting (etc.)... and when you do, it's no longer just HTML.

EDIT: Ooops - sorry - my bad, new here. I was replying to a way way earlier post in this thread. I missed all the posts thereafter. New interface, but I'm on it. lol.

I was wondering, what compiler do you suggest I ought to switch to? Is there one that supports the standard C++ implementation?

>what compiler do you suggest I ought to switch to?
Dev-C++ is usually a good choice.

lol thats weaird the conversation ended with something that was totally diffrent and ironicly narue from colege tells goldeagle2005 using a coledge compiler to use dev c++ witch im allready useing so iguess its best i have this one and so maby i wont have to use a coledge. LOL

Err.. buddy , it would be best you not resurrected dead threads. It would be really good if you just looked at the date of the last reply of a thread before posting in it. And by the way, the thread has been marked solved so please dont post in such threads.

commented: Well said - Salem +1

this is my thred but ok also why not im not adding of any affence to people by doing so

commented: Shut UP +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.