Can someone please tell me a good book to learn this.
Also, while I can do basic C++, I am a bit vague about the meaning of C++ under Windows. Is it the same with programming MFC with Visual C++?
...
Type: Posts; User: vsovereign
Can someone please tell me a good book to learn this.
Also, while I can do basic C++, I am a bit vague about the meaning of C++ under Windows. Is it the same with programming MFC with Visual C++?
...
Okay, so I took your advice and created a small program. I hope this can be integrated to the big program later :
#include <stdio.h>
int main()
{
int c, count;
int word[100];
hi Newbie here :)
I'm doing a program that should count how many words, characters, and how many characters per word inputted.
I manage to do the first two, here's the program:
#include...
Yeah, but if we input c = 0, won't it changed to c = 48 because it's getchar() ?
so it will be
ndigit[c-'0'] = ndigit[c-'0'] +1 --> I input c = 0
ndigit[c-'0'] = ndigit[48-48] +1 ...
so that means that if c = 0 -> c = 48 in ASCII
so
ndigit[48-48] = ndigit[48-48] + 1
ndigit[0] = ndigit[0] + 1
if we initialize ndigit[10] :
for (i = 0; i < 10; i = i + 1)
Hi there,
if there is a code like this :
int c, ndigit[10];
if (c >= '0' && c <= '9')
++ndigit[c-'0'];
Aahh okay :)
So 10 digits + whitespace + other, so yeah; 12 inputs.
thanks!! :)
I'm learning C from the book C Programming Language by Kernighan & Ritchie. I was told that this is the best book.
In the chapter about Arrays they said :
I don't understand! How come 12...
Okay thanks for the explanation :)
Thanks! It's working now.
I'm under the impression that EOF is [Enter] :P
one more question :
I have to write :
Hi all,
I'm trying to create a word count program. With the definition that a word is any sequence of characters that does not contain a blank, tab or newline.
Every time the program...
Okay, so the original question I must answer is :
Therefore I thought that what the program should do is : when tab is pressed, \t is printed on the screen right away. Right now it is printed...
okay, so I put \\t instead of \t
You're right, now I can see \t
But the thing is if I type :
abcd tab efgh enter
/t
as you can see the /t is in the next line.
Hi, newbie here
I'm trying to print \t character to the screen every time I press tab
It doesn't work.
here's my code
#include <stdio.h>
//program to print tab to the screen
int main()
You're right!! I removed the \n and the program works! THANKS! :)
I'm sorry I'm a newbie.
I don't understand your question.
I compile my program...well I use a compiler...I don't know which way the compiler does the compiling.
What? It won't work in mine.
Still stops working after I enter a value behind : enter the length
Is it compiler problem?
I'm using devcpp but my files are .c
I changed my compiler to...
I use printf & scanf in the program below.
I enter a value and then the value is used in the formulas.
But all the program does is printing
and although I can put some number... the program...
thank you for the help everyone :)
The compiler keeps returning this message:
return type of 'main' is not `int'
and stops compiling.
But I should be able to use void type with main shouldn't I?
thank you! :)
Help! I don't know what's wrong...
It keeps giving error message
But I'm sure nothing is wrong... :(
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
sorry, I was confused...
is it correct to say that fprintf is when you want to write something to an external file?
what's the difference between fprintf & printf ?
if we read directly from a file, can we use printf to write the content?
thank you everyone!
it's all clear now :)