Jump to content

What am I doing wrong?

grimreeper132

Quite simply I am trying to write a bit of code that would turn two spaces into one. Why, because why not, it will be handy to learn maybe, shush me stop asking random pointless questions about why your doing something. (I have been spending far too long with my family and am going mad, please help me)

e.g. (using - as a space as it's clearer that way maybe, dunno, I am, shush)

word--word

into

word-word

 

Now then I am obviously doing it wrong as it anit working, but I am just wondering two things, how wrong am I and what would a better coding solution be to what I'm doing (as that anit doing jack shit right)

 

the code is this (I have added line numbers on the left for both mine and possibly your reference if I have done something stupid in there so I can easily see where, as I canny be arsed working out what line your talking about each time, and I am sure you canny be either arsed counting lines every time you spot a mistake as I imagine there is a few)

Spoiler

1- #include <stdio.h>

2- int main(void)
3- {
4-     int c, s;
5-     s=0;
6-     while (c=getchar())
7-         {
8-         if (c == ' ')
9-             ++s;
10-         if (s<=2)
11-             {
12-             s=s-1;
13-             printf("\b");
14-         }
15-     }
16- }

 

thanks in advance, as I probably have presented this post in the improper way for this section, so yea meh that's life. Heads up I have very shitty wifi/internet at the moment, it takes about 2-5 mins to load a page so I might be slow to reply

The owner of "too many" computers, called

The Lord of all Toasters (1920X 1080ti 32GB)

The Toasted Controller (i5 4670, R9 380, 24GB)

The Semi Portable Toastie machine (i7 3612QM (was an i3) intel HD 4000 16GB)'

Bread and Butter Pudding (i7 7700HQ, 1050ti, 16GB)

Pinoutbutter Sandwhich (raspberry pi 3 B)

The Portable Slice of Bread (N270, HAHAHA, 2GB)

Muffinator (C2D E6600, Geforce 8400, 6GB, 8X2TB HDD)

Toastbuster (WIP, should be cool)

loaf and let dough (A printer that doesn't print black ink)

The Cheese Toastie (C2D (of some sort), GTX 760, 3GB, win XP gaming machine)

The Toaster (C2D, intel HD, 4GB, 2X1TB NAS)

Matter of Loaf and death (some old shitty AMD laptop)

windybread (4X E5470, intel HD, 32GB ECC) (use coming soon, maybe)

And more, several more

Link to comment
Share on other sites

Link to post
Share on other sites

I'm going to make an assumption that this is C.

 

The first things I see are that you initialize main with void as a paremeter, and I don't know why. You also initialize c as an integer when you are feeding it characters. And then you initialized main as an int returning function and it never gets to return an int. You also don't have {} for the first if statement. Finally, you check if c is a no-character? Try a space in between your quotes.

 

Edited version:

Spoiler

#include <stdio.h>

void main(){
  int s = 0;
  char c;
  while(c=getchar()){
  	if(c==' '){
  		++s;
  		if(s<=2){
            s=s-1;
            printf("\b");
        }
    }
  }
}

 

I have no idea if that works but it at least compiles without errors on my Linux box I wrote it in. (fix the indentation, LTT is being a pain)

Join the Appleitionist cause! See spoiler below for answers to common questions that shouldn't be common!

Spoiler

Q: Do I have a virus?!
A: If you didn't click a sketchy email, haven't left your computer physically open to attack, haven't downloaded anything sketchy/free, know that your software hasn't been exploited in a new hack, then the answer is: probably not.

 

Q: What email/VPN should I use?
A: Proton mail and VPN are the best for email and VPNs respectively. (They're free in a good way)

 

Q: How can I stay anonymous on the (deep/dark) webzz???....

A: By learning how to de-anonymize everyone else; if you can do that, then you know what to do for yourself.

 

Q: What Linux distro is best for x y z?

A: Lubuntu for things with little processing power, Ubuntu for normal PCs, and if you need to do anything else then it's best if you do the research yourself.

 

Q: Why is my Linux giving me x y z error?

A: Have you not googled it? Are you sure StackOverflow doesn't have an answer? Does the error tell you what's wrong? If the answer is no to all of those, message me.

 

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, grimreeper132 said:

Quite simply I am trying to write a bit of code that would turn two spaces into one. Why, because why not, it will be handy to learn maybe, shush me stop asking random pointless questions about why your doing something. (I have been spending far too long with my family and am going mad, please help me)

e.g. (using - as a space as it's clearer that way maybe, dunno, I am, shush)

word--word

into

word-word

 

Now then I am obviously doing it wrong as it anit working, but I am just wondering two things, how wrong am I and what would a better coding solution be to what I'm doing (as that anit doing jack shit right)

 

the code is this (I have added line numbers on the left for both mine and possibly your reference if I have done something stupid in there so I can easily see where, as I canny be arsed working out what line your talking about each time, and I am sure you canny be either arsed counting lines every time you spot a mistake as I imagine there is a few)

  Hide contents

1- #include <stdio.h>

2- int main(void)
3- {
4-     int c, s;
5-     s=0;
6-     while (c=getchar())
7-         {
8-         if (c == ' ')
9-             ++s;
10-         if (s<=2)
11-             {
12-             s=s-1;
13-             printf("\b");
14-         }
15-     }
16- }

 

thanks in advance, as I probably have presented this post in the improper way for this section, so yea meh that's life. Heads up I have very shitty wifi/internet at the moment, it takes about 2-5 mins to load a page so I might be slow to reply

Quick glance: Main problem -> getchar only returns when you hit enter, not after every character you type.

Link to comment
Share on other sites

Link to post
Share on other sites

The first thing I'm seeing is that the while loop will never exit, because the implicit evaluation requires 0, which as far as I know, a person cannot input NUL or \0 or whatever. Unless it's your intention to make the user force-quit the program.

 

Terminals will usually echo what you typed, but this isn't normally accessible to the program you're running. So if you were expecting printf("\b"); reducing your spaces of what you typed in the terminal, this won't work. This will print a backspace key, but it only affects the string in which you gave printf. So it prints nothing. But if you did printf("Hello\b world!\n"); it would print "Hell world!"

 

EDIT: So some further investigation showed me that most terminals use buffered inputs. Meaning you must press enter to actually input the thing to the program. You can disable this, if you really want: https://stackoverflow.com/questions/1798511/how-to-avoid-press-enter-with-any-getchar

Link to comment
Share on other sites

Link to post
Share on other sites

12 hours ago, LtStaffel said:

-SNIP-

yea it's C, I forgot to say that. what's the better way of starting it then, as I was originally putting

main()

{

and it also complains with

void main()

 

but it complained so changed to that as it didn't complain that way. guessing your meaning line 8 by the no character and there is a space in there but it might not be clear to see. as for that piece of code unforgettably it doesn't seam to work as word--word stays as word--word instead of turning into word-word

 

 

 

9 hours ago, Unimportant said:

Quick glance: Main problem -> getchar only returns when you hit enter, not after every character you type.

how do you fix that problem???

 

8 hours ago, M.Yurizaki said:

-SNIP-

for the backspace of it becoming hell world that's ok in my opinion as it would still turn word--word into word-word, and the only time it would matter is at the end, but cause it's a space you can't see the difference between word-- and word-

I am using a windows  machine at the moment, as I have not set up a linux machine to do this as I haven't had time, and I haven't sorted out my laptop either to dual boot, like I want it to again because I haven't had time, (I will be at some point soon probably) so the doesn't work, so how do you do it on windows???

system ("/bin/stty raw");

 

The owner of "too many" computers, called

The Lord of all Toasters (1920X 1080ti 32GB)

The Toasted Controller (i5 4670, R9 380, 24GB)

The Semi Portable Toastie machine (i7 3612QM (was an i3) intel HD 4000 16GB)'

Bread and Butter Pudding (i7 7700HQ, 1050ti, 16GB)

Pinoutbutter Sandwhich (raspberry pi 3 B)

The Portable Slice of Bread (N270, HAHAHA, 2GB)

Muffinator (C2D E6600, Geforce 8400, 6GB, 8X2TB HDD)

Toastbuster (WIP, should be cool)

loaf and let dough (A printer that doesn't print black ink)

The Cheese Toastie (C2D (of some sort), GTX 760, 3GB, win XP gaming machine)

The Toaster (C2D, intel HD, 4GB, 2X1TB NAS)

Matter of Loaf and death (some old shitty AMD laptop)

windybread (4X E5470, intel HD, 32GB ECC) (use coming soon, maybe)

And more, several more

Link to comment
Share on other sites

Link to post
Share on other sites

7 hours ago, grimreeper132 said:

how do you fix that problem???

You have to disable buffered inputs from the terminal

7 hours ago, grimreeper132 said:

for the backspace of it becoming hell world that's ok in my opinion as it would still turn word--word into word-word, and the only time it would matter is at the end, but cause it's a space you can't see the difference between word-- and word-

I am using a windows  machine at the moment, as I have not set up a linux machine to do this as I haven't had time, and I haven't sorted out my laptop either to dual boot, like I want it to again because I haven't had time, (I will be at some point soon probably) so the doesn't work, so how do you do it on windows???


system ("/bin/stty raw");

You can use a virtual machine any time you want to work on an OS but don't want to dual boot and you don't need GPU acceleration.

 

Anyway, on Windows this may be done by using the conio.h header (from https://stackoverflow.com/questions/421860/capture-characters-from-standard-input-without-waiting-for-enter-to-be-pressed)

Quote

That's not possible portably in pure C++, because it depends too much on the terminal used that may be connected with stdin (they are usually line buffered). You can, however use a library for that:

  • conio available with windows compilers. Use the function _getch() to give you a character without waiting for the enter key. I'm not a frequent windows developer, but i've seen my classmates just include conio.h and use it. See conio.h at wikipedia. It lists getch, which is declared deprecated in Visual C++.
  • curses available for linux, compatible curses implementations are available for windows too. It has also a getch function. (try man getch to view its manpage). See Curses at wikipedia.

I would recommend you to use curses if you aim for cross platform compatibility. That said, I'm sure there are functions that you can use to switch off line buffering (i believe that's called "raw mode", as opposed to "cooked mode" (look into man stty)). Curses would handle that for you in a portable manner if i'm not mistaken.

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, M.Yurizaki said:

You have to disable buffered inputs from the terminal

You can use a virtual machine any time you want to work on an OS but don't want to dual boot and you don't need GPU acceleration.

 

Anyway, on Windows this may be done by using the conio.h header (from https://stackoverflow.com/questions/421860/capture-characters-from-standard-input-without-waiting-for-enter-to-be-pressed)

 

can't set either a VM or my dual boot till I'm home cause I don't have a USB pen or access to my NAS and other things I will need (cause my laptop has alot of data on it) as for that thanks I will look into seeing how you do that, I am using coding in C though and the last quote says C++ does it make a difference or would it still work

The owner of "too many" computers, called

The Lord of all Toasters (1920X 1080ti 32GB)

The Toasted Controller (i5 4670, R9 380, 24GB)

The Semi Portable Toastie machine (i7 3612QM (was an i3) intel HD 4000 16GB)'

Bread and Butter Pudding (i7 7700HQ, 1050ti, 16GB)

Pinoutbutter Sandwhich (raspberry pi 3 B)

The Portable Slice of Bread (N270, HAHAHA, 2GB)

Muffinator (C2D E6600, Geforce 8400, 6GB, 8X2TB HDD)

Toastbuster (WIP, should be cool)

loaf and let dough (A printer that doesn't print black ink)

The Cheese Toastie (C2D (of some sort), GTX 760, 3GB, win XP gaming machine)

The Toaster (C2D, intel HD, 4GB, 2X1TB NAS)

Matter of Loaf and death (some old shitty AMD laptop)

windybread (4X E5470, intel HD, 32GB ECC) (use coming soon, maybe)

And more, several more

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, M.Yurizaki said:

It says you'll have issues if you use C++, not that it's only for C++. conio.h is a C header file.

oh whoops so it does sorry

The owner of "too many" computers, called

The Lord of all Toasters (1920X 1080ti 32GB)

The Toasted Controller (i5 4670, R9 380, 24GB)

The Semi Portable Toastie machine (i7 3612QM (was an i3) intel HD 4000 16GB)'

Bread and Butter Pudding (i7 7700HQ, 1050ti, 16GB)

Pinoutbutter Sandwhich (raspberry pi 3 B)

The Portable Slice of Bread (N270, HAHAHA, 2GB)

Muffinator (C2D E6600, Geforce 8400, 6GB, 8X2TB HDD)

Toastbuster (WIP, should be cool)

loaf and let dough (A printer that doesn't print black ink)

The Cheese Toastie (C2D (of some sort), GTX 760, 3GB, win XP gaming machine)

The Toaster (C2D, intel HD, 4GB, 2X1TB NAS)

Matter of Loaf and death (some old shitty AMD laptop)

windybread (4X E5470, intel HD, 32GB ECC) (use coming soon, maybe)

And more, several more

Link to comment
Share on other sites

Link to post
Share on other sites

7 minutes ago, edward30 said:

Could you tell us exactly what behavior you're looking for?

sorry I thought I made it clear, I am using windows and I want to write a bit of code which means when I type into console thingy which I have I want it to turn

word  word to

word word 

 

essentially turning a double space into a single space, meaning you can't write

word          word

instead it would force you to write

word word 

 

because I am wanting to know how, not because I need to for any project I just sorta want to learn how to do it

 

hope that helps

The owner of "too many" computers, called

The Lord of all Toasters (1920X 1080ti 32GB)

The Toasted Controller (i5 4670, R9 380, 24GB)

The Semi Portable Toastie machine (i7 3612QM (was an i3) intel HD 4000 16GB)'

Bread and Butter Pudding (i7 7700HQ, 1050ti, 16GB)

Pinoutbutter Sandwhich (raspberry pi 3 B)

The Portable Slice of Bread (N270, HAHAHA, 2GB)

Muffinator (C2D E6600, Geforce 8400, 6GB, 8X2TB HDD)

Toastbuster (WIP, should be cool)

loaf and let dough (A printer that doesn't print black ink)

The Cheese Toastie (C2D (of some sort), GTX 760, 3GB, win XP gaming machine)

The Toaster (C2D, intel HD, 4GB, 2X1TB NAS)

Matter of Loaf and death (some old shitty AMD laptop)

windybread (4X E5470, intel HD, 32GB ECC) (use coming soon, maybe)

And more, several more

Link to comment
Share on other sites

Link to post
Share on other sites

12 minutes ago, M.Yurizaki said:

It says you'll have issues if you use C++, not that it's only for C++. conio.h is a C header file.

right now then, as you can probably tell I am new to this programming stuff, (I have only about an hour or two experience actually coding) so how do you do the conio.h thing??? is it like stdio.h where you write

#include <stdio.h> at the beginning instead it's conio.h or is it something else???

The owner of "too many" computers, called

The Lord of all Toasters (1920X 1080ti 32GB)

The Toasted Controller (i5 4670, R9 380, 24GB)

The Semi Portable Toastie machine (i7 3612QM (was an i3) intel HD 4000 16GB)'

Bread and Butter Pudding (i7 7700HQ, 1050ti, 16GB)

Pinoutbutter Sandwhich (raspberry pi 3 B)

The Portable Slice of Bread (N270, HAHAHA, 2GB)

Muffinator (C2D E6600, Geforce 8400, 6GB, 8X2TB HDD)

Toastbuster (WIP, should be cool)

loaf and let dough (A printer that doesn't print black ink)

The Cheese Toastie (C2D (of some sort), GTX 760, 3GB, win XP gaming machine)

The Toaster (C2D, intel HD, 4GB, 2X1TB NAS)

Matter of Loaf and death (some old shitty AMD laptop)

windybread (4X E5470, intel HD, 32GB ECC) (use coming soon, maybe)

And more, several more

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, grimreeper132 said:

right now then, as you can probably tell I am new to this programming stuff, (I have only about an hour or two experience actually coding) so how do you do the conio.h thing??? is it like stdio.h where you write

#include <stdio.h> at the beginning instead it's conio.h or is it something else???

Yes.

 

Use angle brackets (< and >) if you are including a library that the compiler should know about (i.e., a "standard" library). Use double quotes if you're including your own header file in the project directory (e.g., if you're including foobar.h in C:\Users\someuser\Documents\ and the source file is also in C:\Users\someuser\Documents, you would just do #include "foobar.h")

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, edward30 said:

I take it from what you've said above that you want it to consume each letter as it is typed, without waiting for the user to hit enter. Do you want it to print the modified string after the user does press enter? Do you want it to modify the string as it is written on the command line? You have to be very precise about what you want to get accurate advice.

I though I was being accurate but yes, I want it to write it as only one space between the words, even if the space has been pressed multiple times without needing to press enter.

The owner of "too many" computers, called

The Lord of all Toasters (1920X 1080ti 32GB)

The Toasted Controller (i5 4670, R9 380, 24GB)

The Semi Portable Toastie machine (i7 3612QM (was an i3) intel HD 4000 16GB)'

Bread and Butter Pudding (i7 7700HQ, 1050ti, 16GB)

Pinoutbutter Sandwhich (raspberry pi 3 B)

The Portable Slice of Bread (N270, HAHAHA, 2GB)

Muffinator (C2D E6600, Geforce 8400, 6GB, 8X2TB HDD)

Toastbuster (WIP, should be cool)

loaf and let dough (A printer that doesn't print black ink)

The Cheese Toastie (C2D (of some sort), GTX 760, 3GB, win XP gaming machine)

The Toaster (C2D, intel HD, 4GB, 2X1TB NAS)

Matter of Loaf and death (some old shitty AMD laptop)

windybread (4X E5470, intel HD, 32GB ECC) (use coming soon, maybe)

And more, several more

Link to comment
Share on other sites

Link to post
Share on other sites

13 hours ago, grimreeper132 said:

how do you fix that problem???

 

I am using a windows machine at the moment,...

There's no portable way, but on windows the conio.h header should be available which gives you the getche() function that does what you want.

 

The better option would probably be to just read a complete string from the user, do your thing with it, and then print out the result.

Link to comment
Share on other sites

Link to post
Share on other sites

On ‎6‎/‎26‎/‎2017 at 1:02 PM, LtStaffel said:

I'm going to make an assumption that this is C.

 

The first things I see are that you initialize main with void as a paremeter, and I don't know why. You also initialize c as an integer when you are feeding it characters. And then you initialized main as an int returning function and it never gets to return an int. You also don't have {} for the first if statement. Finally, you check if c is a no-character? Try a space in between your quotes.

 

Edited version:

  Hide contents


#include <stdio.h>

void main(){
  int s = 0;
  char c;
  while(c=getchar()){
  	if(c==' '){
  		++s;
  		if(s<=2){
            s=s-1;
            printf("\b");
        }
    }
  }
}

 

I have no idea if that works but it at least compiles without errors on my Linux box I wrote it in. (fix the indentation, LTT is being a pain)

see schoolfreeware qb64 videos on youtube

also are your if statements being "ended" correctly

end if

Link to comment
Share on other sites

Link to post
Share on other sites

51 minutes ago, Unimportant said:

There's no portable way, but on windows the conio.h header should be available which gives you the getche() function that does what you want.

 

The better option would probably be to just read a complete string from the user, do your thing with it, and then print out the result.

I have tried using the conio.h but well that brings a few issues as well, as enter just starts you typing from the start of the line again, and the \b just prints \b rather than moving the cursor text writer part back a space.

 

5 minutes ago, bcguru9384 said:

see schoolfreeware qb64 videos on youtube

also are your if statements being "ended" correctly

end if

I will look as a couple of them maybe tomorrow when I get back internet which isn't .5Mbps and get back my 30 Mbps, which sounds like a massive improvement and it is, but I need more than 30 a lot of the times

The owner of "too many" computers, called

The Lord of all Toasters (1920X 1080ti 32GB)

The Toasted Controller (i5 4670, R9 380, 24GB)

The Semi Portable Toastie machine (i7 3612QM (was an i3) intel HD 4000 16GB)'

Bread and Butter Pudding (i7 7700HQ, 1050ti, 16GB)

Pinoutbutter Sandwhich (raspberry pi 3 B)

The Portable Slice of Bread (N270, HAHAHA, 2GB)

Muffinator (C2D E6600, Geforce 8400, 6GB, 8X2TB HDD)

Toastbuster (WIP, should be cool)

loaf and let dough (A printer that doesn't print black ink)

The Cheese Toastie (C2D (of some sort), GTX 760, 3GB, win XP gaming machine)

The Toaster (C2D, intel HD, 4GB, 2X1TB NAS)

Matter of Loaf and death (some old shitty AMD laptop)

windybread (4X E5470, intel HD, 32GB ECC) (use coming soon, maybe)

And more, several more

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, bcguru9384 said:

#include <stdio.h> void main(){ int s = 0; char c; while(c=getchar()){

 

if(c==' ')

then { ++s;

end if

if(s<=2)

then { s=s-1;

end if

printf("\b"); } } } }

totallly did not quote how i thought but these "end if" and "then" should be close to correct

why use if when theres no declaration (then ,or)

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, M.Yurizaki said:

This is C, C has no "Then" or "End if" when defining if-statement scopes.

that'll explain all the syntax errors and confusion I was having

The owner of "too many" computers, called

The Lord of all Toasters (1920X 1080ti 32GB)

The Toasted Controller (i5 4670, R9 380, 24GB)

The Semi Portable Toastie machine (i7 3612QM (was an i3) intel HD 4000 16GB)'

Bread and Butter Pudding (i7 7700HQ, 1050ti, 16GB)

Pinoutbutter Sandwhich (raspberry pi 3 B)

The Portable Slice of Bread (N270, HAHAHA, 2GB)

Muffinator (C2D E6600, Geforce 8400, 6GB, 8X2TB HDD)

Toastbuster (WIP, should be cool)

loaf and let dough (A printer that doesn't print black ink)

The Cheese Toastie (C2D (of some sort), GTX 760, 3GB, win XP gaming machine)

The Toaster (C2D, intel HD, 4GB, 2X1TB NAS)

Matter of Loaf and death (some old shitty AMD laptop)

windybread (4X E5470, intel HD, 32GB ECC) (use coming soon, maybe)

And more, several more

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, grimreeper132 said:

that'll explain all the syntax errors and confusion I was having

I strongly recommend reading https://en.wikipedia.org/wiki/C_syntax

 

And after playing around with your original source code, using gcc as my compiler, I came up with this. However I'm not sure if this is what you want:

#include <stdio.h>
#include <conio.h>

int main(void){
  int s;
  char c;
  s = 0;
  while(c = getch()){
    if (c == ' '){
      ++s;
      if (s <= 2){
        s = s - 1; /* Should probably use s--; */
        printf("\b");
      }
    }
    printf("%c",c);
  }
}

This will prevent double spacing.

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, M.Yurizaki said:

I strongly recommend reading https://en.wikipedia.org/wiki/C_syntax

 

And after playing around with your original source code, using gcc as my compiler, I came up with this. However I'm not sure if this is what you want:


#include <stdio.h>
#include <conio.h>

int main(void){
  int s;
  char c;
  s = 0;
  while(c = getch()){
    if (c == ' '){
      ++s;
      if (s <= 2){
        s = s - 1; /* Should probably use s--; */
        printf("\b");
      }
    }
    printf("%c",c);
  }
}

This will prevent double spacing.

yes that is what I wanted, almost whether this problem is because of my compiler or not is another question though (it might be), if I type in "word                         word" it comes out "wor word" which is what I want sorta, I don't want a missing d at the end of the first word apart from that yes that is what I want (as I said though this could just be because of my compiler thingy (I'm using Pelle C as it was the first one which I found)

The owner of "too many" computers, called

The Lord of all Toasters (1920X 1080ti 32GB)

The Toasted Controller (i5 4670, R9 380, 24GB)

The Semi Portable Toastie machine (i7 3612QM (was an i3) intel HD 4000 16GB)'

Bread and Butter Pudding (i7 7700HQ, 1050ti, 16GB)

Pinoutbutter Sandwhich (raspberry pi 3 B)

The Portable Slice of Bread (N270, HAHAHA, 2GB)

Muffinator (C2D E6600, Geforce 8400, 6GB, 8X2TB HDD)

Toastbuster (WIP, should be cool)

loaf and let dough (A printer that doesn't print black ink)

The Cheese Toastie (C2D (of some sort), GTX 760, 3GB, win XP gaming machine)

The Toaster (C2D, intel HD, 4GB, 2X1TB NAS)

Matter of Loaf and death (some old shitty AMD laptop)

windybread (4X E5470, intel HD, 32GB ECC) (use coming soon, maybe)

And more, several more

Link to comment
Share on other sites

Link to post
Share on other sites

31 minutes ago, M.Yurizaki said:

This is C, C has no "Then" or "End if" when defining if-statement scopes.

if no declarations and ending then your doing nothing more than using math rules(()) to do these functions

c is built from basic.....

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, bcguru9384 said:

if no declarations and ending then your doing nothing more than using math rules(()) to do these functions

c is built from basic.....

In C you do not use "then" or "end". You use curly braces ( {} )to denote the if-statement scope, except for single line statements, which you can omit the curly braces if you wish. This is not because we're doing math or whatever. This is the clearly defined syntax of the C language. It's like saying "well in German you capitalize certain nouns, therefore in English, you should be doing the same." That's not how it works.

 

C was also not built from BASIC. It was "built" from BCPL, which came from CPL, which came from ALGOL, which came from FORTRAN.

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, M.Yurizaki said:

BCPL

basic combined programming language

 

Link to comment
Share on other sites

Link to post
Share on other sites

point is all the language or "instruction sets" are built off each other and are derived due to the machine hardware being used at the time

usually new instruction set was made to account for extra or lack of memory available not so much about cpu power

best way to explain is this

full set is like writing a school essay where spelling and grammar punctuations matter

vs

shorthand like texting with friend

one you say later

other

l8r

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×