I would like to break the loop when the last digit is detected.
Type: Posts; User: xp5
I would like to break the loop when the last digit is detected.
Hi, I'm trying to read an unspecified number of integers from the user's input. However I don't know how to make it so that the program will keep on scanning after the first integer. I try to...
Thank you very much for the in depth explanation...that's exactly what I needed!
Yes, the code is below:
#include <stdio.h>
#include <stdlib.h>
#define STRSIZE 1000
int main(void)
Yes, I do want to read through the file to see how many words there are, and then allocate the memory according to the number of words there are in the file. I'm just having trouble allocating...
n was just a variable that i was testing with, and it is not currently in used. The file story.txt contains: "Today is cold, yesterday was hot"
Hi,
I want to be able to store a group of words from a file to an array. I try using the malloc() function to allocate space for all the word in a file, but i'm not sure on how to use the malloc...
WOW! thank you, i didn't see that!
Hi, I'm writing a program that will identify whether or not the user's input string is a palindrome or not. However, the program keeps the inputed string is a palindrome eventhough it is not. It...
I got it!! thank you matsp!
The sorting is working perfectly fine now. I have another question, how do I make it print 10 integers per line? For example the sorted array is: "1 2 3 4 5 6 7 8 9 10 11 12 13". How do i make the...
Thank you dwks and matsp !!!
matsp: Yes, I want the former values (the first group) to be sorted with the second group of values too.
I'm working on that right now.
Hi, this is sorting selection program that i'm writing. The sorting works fine, however, I don't know how to make it so that the program sort a group of values then go to the next group of values to...
hey thanks, I absolutely forgot about the break command!!
sorry i figure it out!
Hi, I can't seem to get out of the first for loop below, so that it will pass the user inputed array on to the sorting function. Is there something that I'm doing wrong with the first for loop?
...
ahhh...thank you!
For this part: "maxpos = x[i] > x[maxpos] ? i: maxpos; "
Can someone explains to me what "? i:" means?
Thank you!!
Hi,
I'm reading this programming book and it gives a sample code:
int get_maxpos(int x[], int eff_size)
{
int i, maxpos = 0;
for (i = 0; i < eff_size; i++)
I'm trying to pass values from the main() function to the selectionSort() function, but it keeps saying the following:
hw2n1.c: In function `main':
hw2n1.c:25: warning: passing arg 1 of...
thanks
Hi, i'm writing a sorting program, and I'm stuck in a for loop and I don't know what's wrong with it. The following is my code:
#include <stdio.h>
#define NUM_INT 1000
int main (void)
{...
Hi I'm trying to use the for loop, but i'm having trouble figuring out how to use it. Do you know what i'm doing wrong?
int n;
int output[60];
int index = 0;
int condition;
int...
yeah, i have to do it without using pow(x,y)
Hi, is there a way to raise x to the power of y (x^y), without using the math.h library and the pow(x,y) function?