works! thank you
Type: Posts; User: Zach786
works! thank you
I have very basic program consist of two source files. Main.c contains the main function. Pint.c multiplies i by 2 and prints it. for whatever reason the program error out after the enter interger...
[QUOTE=AndiPersti;1165792]
while ((c=getchar()) !=EOF);
So I have removed the semicolon. I can't remove the semicolon from else statement as laserlight suggested. I am getting compiler error....
Tried that but still it doesn't seem to work correctly. Here the new code
#include <stdio.h>
int main (void)
{
int c=0;
int num_words=0, num_chars=0, num_newlines=0;
inner switch statement doesn't get executed if you don't input 3. but it get works if the 3 is inputted.
void main (){
int zero=0;
int one=0;
int two=0;
int three=0;
int four=0;
int...
here is my new code. It still doesn't count character/words/new line correctly
#include <stdio.h>
int main (void)
{
int c=0;
Second, please explain what you think is happening in the following line:
Basically it's a while loop reading keys from the keyboard by using function getchar(). The reading of characters from...
added the break statement but there is no output generate from inner switch statement
12769
I tried that. it still doesn't work.
12768
here is my new code
#include <stdio.h>
int main (void)
{
char c=0;
I am extend the program so number 3 is shown in words. E.g. Number three appears two times. Anything above 3 will print " the numbers appears more than two times. In order to accomplish this, I have...
My C program doesn't seem to be working correctly, output is completely off . Basically the program is suppose to output amount of characters, amount of word and amount of newlines that have been...
Thank you! Laserlight:)
So I moved the int Powervalue; before int X;. I am getting new warnings i.e. C4700: Uninitialzied local variable 'PowerValue' Used and also get same error for 'NumbertoMultiply'
I can't seem to figure out why I am get the error 2065: Undeclared identifier for 'PowerValue' and C2143:Syntax Error : Missing ';' before 'type' on line 13.
#include <stdio.h>
#include...
Arithmetic Right shift will preserve whether an integer is negative or positive. In a logical right shift, it will lose the sign indicator i.e. make negative number into a positive number. So I wrote...
Logical Shift: Shifting left by n bits on signed or unsigned binary number has effect of multiplying it by 2^n and Shifting right by n bits on an unsigned binary number has the effect of dividing by...
could you pls explain this logic (((-1)>>1)<0) ? what does -1 represent?
If input value was shifted to the right on bit level. How can I determine whether a logical or arithmetic shift is performed.
#include <stdio.h>
#include <stdlib.h>
void main ()
# include void main (){ int zero=0; int one=0; int two=0; int three=0; int four=0; int other_char=0; int x; while ((x=getchar()) !=26 && x!=EOF) { switch(x) { case'0': zero++;...
I also initialized other_char=0 but it doesn't seem to count other characters correctly.
It's working expect it doesn't' seem to count the character correctly.
12736
Isn't this initialization the variables?
int zero,one, two, three, four=0;
I have changed it though
I wrote a C-program to count how many times each of the numbers 0-4 have been typed. I am suppose to use (EOF) function as part of this assignment.
void main (){
int zero,one, two, three,...
I am relatively new to programming. I need help writing this program.
Write a C-program that efficiently multiplies a number by a factor 2 to the power n. The number to multiply and n are...