Oh alright thanks aot. That helped me tons!
Type: Posts; User: prafiate
Oh alright thanks aot. That helped me tons!
I haven't learned arrays yet, so I dont really understand the correction. I also don't quite pick up on the logic with the modulus.
The program works fine up until after the first calculation. The program prompts the user to enter Y or N to calculate again. But scanf wont take the the input.
Also I know it would be better to...
if
(day > 3 && day < 21 || day < 23 && day < 31)
printf("\n%dth", day);
elseif (day == 1 || day == 21 || day == 31)
printf("\n%dst", day);
else
...
Also my book hasn't gotten to character strings yet. So I guess i'll have to find another way to configure the ending for the days
So I would really only declare a variable as char if i wanted to store a singler character? otherwise I should use a character string?
The program is supposed to have the user enter a date in the format of day month year. Example 12 12 2012 then dispaly it as 12th december 2012.
When I run the code it displays 12h december 2012 or...
Oh, alright, its strange that it compiled and the program did what I intended, but I'll change it to the correct value types. Thanks
Actually I had changed scanf call too along with the printf. I...
Thanks! problem solved
This program is supposed to prompt the user to either convert form celsius to degree or vice versa. Then ask for a temperature to be entered and ouput the result. When I enter the temperature, the...
yes, thats good sloves my problem. Thanks!
/*program 3.3 using nested ifs to analyze numbers*/
#include <stdio.h>
#include <limits.h>/*for LONG_MAX*/
int main()
{
long test = 0L; /*stores the integer to be checked*/
...
gcc says: In function 'main':
error: syntax error before "int"
error: syntax error before "char"
#include <stdio.h>
int main(){
int i;
Good to know. Thanks alot
im puzzled because i left the size of my array as [10] just to see what would happend and my program seems to be running fine with no problems. Source code comes right out of a book and the array in...
thanks guys! problem solved. although i am puzzled because it seems to be running fine even though i did not change the size of my array.
ohh, the semicolon at the end of the loop is not supposed to be there. but now when i compile and execute. the program asks for the the count and when i set it. the program ends execution
#include <stdio.h>
#include <string.h>
int main(){
char message [10];
int count, i;
strcpy(message, "Hello World");
printf("Repeat how many times?");
...