Okay thanks. I will try to code out myself first. It is good to learn something new. :)
Type: Posts; User: Alexie
Okay thanks. I will try to code out myself first. It is good to learn something new. :)
Yup it is a assignment. But i want to code out a easiest way cause i don't really understand the top part.
int end = length - 1;
for (int i = 0; i < length; ++i)
{
for (int...
well i found merging number is way simple than character. i have no idea how to start coding. :confused:
Ops: sorry for misunderstanding. any method will do as what my lecturer told me. :cool: But...
Hi all. basically I need to hand up a project on merge and sort array in char.
First input: a c e g
Second input: b d f h
Output: a b c d e f g h
I found this code using bubble sort. But i...
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
int main()
{
int array[100], num1, c, n, num2;
printf("Enter number of elements in array\n");
scanf("%d", &n);
how can do a code for -1 to stop program?
printf("Enter number of elements in array\n");
scanf("%d", &n);
printf("Enter %d elements\n", n);
for ( c = 0 ; c < n ; c++ )
can someone check with my coding?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <conio.h>
int main()
OK thanks . i manage to solve the problem already :)
i have do a research on inword = 1; else inword = 0; that all the number and char = 1 and space = 0; how can i do it on my code?
After looking at the code again. I think i got a problem with it again.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include <ctype.h>
int main()
{
Erm. Can someone help me on the coding? so example the loop is ( int i =0; i<=n; i++) how can i stop the loop at middle?
Oh thanks. Okay i take a try first. :wink:
whats the different between string and linked list? cause i thought we have input a sentence after that look for middle word of the sentence.
char str[50]
printf("\n\n\t Enter A...
actually this is my tomorrow lab test question. i really can't figure out this coding. how can we calculate the middle of the string?
yup. example i input a sentence: hello my name is alex. so i will get the output: name <-- middle in the list.
How can i print the middle of given list?
example:
Input: aaa bbb ccc ddd eee
Output: ccc
how can this code to be done? :confused::confused:
so that mean -1 is somewhat of delete right? if i want delete second element will be 2-1? how about i+1?
printf("\nEnter location of deletion: ");
scanf("%d", &loc);
item = a[loc-1];
for(i=loc-1; i<n; i++)
{
a[i] = a[i+1];
}
...
Thanks for that too. good idea:wink:
Hey Adak! Thanks for your explanation. I got my code working.
if((str[i]== ' ' && str[i+1] != ' ' && inWord++ ))
and also
printf("\n\nThe total number of words are %d ",...
i did use <ctype.h> for counting space
while(str[len]!='\0') len++;
for(i=0;i<=len;i++)
{
while( isspace( str[i] )) { space++; i++; }
{continue;}
...
Oh. so how should i code to let the program know it begin with a space?
I manage to solve the first error by change the line to:
if((str[i]== ' ' && str[i+1] != ' '))
Input: a[space][space][space]d
Output: 2 words
But the next problem I can't solve is:
Input:...
Ok thanks alot. I will try to get a copy soon :)
I don't have any book to learn. I was learn it through youtube.