Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) C++ (Read 6438 times)
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
C++
Apr 13th, 2007 at 8:05pm
Print Post Print Post  
I'm studying C++ and in my book they use the following "std::end1" but I have two C++ compliers and both give me errors that end1 is no part of std, have they replaced it with something else I should use ??  Undecided
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: C++
Reply #1 - Apr 13th, 2007 at 8:23pm
Print Post Print Post  
proudpoppy wrote on Apr 13th, 2007 at 8:05pm:
I'm studying C++ and in my book they use the following "std::end1" but I have two C++ compliers and both give me errors that end1 is no part of std, have they replaced it with something else I should use ??  Undecided


I suspect that that is endl (with a lower case "L" at the end of end) not end1. It represents end-of-line.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Re: C++
Reply #2 - Apr 13th, 2007 at 8:34pm
Print Post Print Post  
may need to clean my glasses !  Grin Must be a misprint in the book the number 1 and the 1 at the end1 is identical, it does respresent end of line.
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: C++
Reply #3 - Apr 13th, 2007 at 8:48pm
Print Post Print Post  
Do you already know C (as opposed to C++)?
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Re: C++
Reply #4 - Apr 14th, 2007 at 3:04am
Print Post Print Post  
Quote:
Do you already know C (as opposed to C++)?

No, I bought the Book C++ 4th edition How to program by Dietel, Had it for several month just decide to open it, most of my programming experience is in Pascal, and Visual Basic. Can't comment to much right now just on page #28 but you got to start somewhere.
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: C++
Reply #5 - Apr 14th, 2007 at 3:26am
Print Post Print Post  
As you may have heard, all of Sesame is written in C/C++. We lean heavily towards C and only use a small portion of the C++ exclusive features. For example, we use classes and objects heavily, but barely use any overloaded operators or C++ I/O streams. Basically we use the C++ object system as a structural/design element and use chiefly C constructs down in the trenches - if you know what I mean.

If there is anything I can do to help you pick it up, let me know.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: C++
Reply #6 - Apr 14th, 2007 at 2:35pm
Print Post Print Post  
Code
Select All
#include	  <stdio.h>

char *a[] = {
	  "Learning",
	  "will",
	  "you",
	  "understand"
};

char *b[] = {
	  "SBasic.",
	  "better",
	  "help",
	  "C/C++"
};

int     main()
{
int     loop;

	  for(loop = 0;loop < 4;loop++)
	  {
		    printf("%s %s ", a[loop], b[3 - loop]);
	  }
	  printf("\n");
	  return(0);
}
 

  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: C++
Reply #7 - Apr 14th, 2007 at 4:14pm
Print Post Print Post  
Shouldn't this:

Code
Select All
char *a[] = {
	  "Learning",
	  "will",
	  "you",
	  "understand"
};

char *b[] = {
	  "SBasic.",
	  "better",
	  "help",
	  "C/C++"
}; 



be this:

Code
Select All
char *a[] = {
	  "Learning",
	  "will",
	  "you",
	  "understand"
};

char *b[] = {
	  "SBasic.",
	  "help",
	  "better",
	  "C/C++"
}; 

?
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: C++
Reply #8 - Apr 14th, 2007 at 6:28pm
Print Post Print Post  
Bob,

Not if you want the output to follow english word order.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: C++
Reply #9 - Apr 14th, 2007 at 8:53pm
Print Post Print Post  
I thought that your version would translate to:
"Learning SBasic will better you help understand C/C++

And I thought my version would translate to:
"Learning SBasic will help you better understand C/C++"

=============

I have not used C/C++ so I was trying to do some intuitive compiling.  I guess I will have to read a book now.

Taking a closer look, it seems that the "b" is based on (3-loop) which would translate to 3,2,1,0.  Are those a/b strings indexed starting at 0? If not, how is a negative handled for that last "b" ?




  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: C++
Reply #10 - Apr 14th, 2007 at 9:01pm
Print Post Print Post  
Bob_Hansen wrote on Apr 14th, 2007 at 8:53pm:
I thought that your version would translate to:
"Learning SBasic will better you help understand C/C++

And I thought my version would translate to:
"Learning SBasic will help you better understand C/C++"


I saw that that was what you were after. But, even then I can't agree. Learning a high level language like SBasic doesn't help much in learning a low level language like C, or an object oriented language like C++.

Quote:
=============

I have not used C/C++ so I was trying to do some intuitive compiling.  I guess I will have to read a book now.



Be glad I didn't throw in any complicated pointer arithmatic.

Code
Select All
*(**n)++ = (Money *)*ptr.resolve()->n++
 



Quote:
Taking a closer look, it seems that the "b" is based on (3-loop) which would translate to 3,2,1,0.  Are those a/b strings indexed starting at 0? If not, how is a negative handled for that last "b" ?


I obfuscated it a little so Proud Poppy would run it through his C compiler. Yes, C and C++ index arrays starting at zero.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: C++
Reply #11 - Apr 15th, 2007 at 12:33am
Print Post Print Post  
So, with an index of 0, and b(3-loop), your original example translates to:
"Learning C/C++ will help you better understand SBasic", is that correct?

That is a big difference.
======================
And high level vs. low level reminds me of many years ago when I had to program at assembly level language using hexadecimal code, throwing 16 toggle switches, and pushing a Send Button to add the instruction to the memory stack, then repeating the process again for the next instruction of 16 binary bits.  Aargh!  Glad I don't have to do that any more.  We had transistors them, in between relays and integrated circuits.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: C++
Reply #12 - Apr 15th, 2007 at 12:49am
Print Post Print Post  
Bob_Hansen wrote on Apr 15th, 2007 at 12:33am:
So, with an index of 0, and b(3-loop), your original example translates to:
"Learning C/C++ will help you better understand SBasic", is that correct?


Yah.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: C++
Reply #13 - Apr 15th, 2007 at 1:37am
Print Post Print Post  
Thanks for the help Mark

Now I C.   Roll Eyes

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Re: C++
Reply #14 - Apr 15th, 2007 at 2:24am
Print Post Print Post  
I do have a question, the Microsoft Visual C++ that came with the book, displays programs in a command window, and ask you to press any key to close, the dev c++ program seems to do the same thing only it just flashes the command box on the screen so fast you can't see it, how can I get the window to pause long enough to see the output? I don't believe I ever be a c/c++ programmer I get lost after 20 lines of code  but I enjoy learning and challanges but I was thinking anything I can learn would help with Sbasic programming. So far c/c++ makes more sense to me than any other programming languages I've used in the past. I have amazed myself in the past with what I could do, just looking at the application I have in Sesame its hard to believe I created it, "with a lot of help from here" A wise man said years ago, if  he can find a book on it he can do it, I was fifteen at the time and I believed him, I've read alot of books. Wink
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print