Posts Tagged ‘Array’
How do I modify a main method to call on a selectionSort program?
public static void main(String[] args)
I need to modify it so that it uses another program to sort the array from lowest to highest, which main method is:
public static void sort(double[] a)
I’m not sure if more code is needed from the programs for you to answer, but i can add it if it is.
This is in Java
By: Manthony
How to read an image in C? And i want to save each pixel value in an array?
The code can be in any C compiler or C++ compiler……
Please help me someone……..
I am in the end of my project…….Its URGENT……
By: Dhilsen
Can you help with this java codes?
double [ ] cost = new coudlbe[5];
what code would i use to acces the last element of the array?
at first i though it was
cost[5]
but i dunno if thats working.
By: buckeyefan1191
How do I write multiple lines of string to an output file in C?
When I use the following code, the output file contains the contents but without the newlines even when I specified it to write a new line after every entry.
FILE *ofp;
ofp = fopen(”history.list”, “w”);
int temp = cmdnum;
while(temp!=0)
{
fprintf(ofp, “%s\n”, history[temp-1]);
temp–;
}
For example if history contains:
a
b
c
The output file that results is:
abc
Thanks for your
By: grandmasterlau
How do you create dynamic links in PHP and MySQL using _GET and _POST?
I have a recipe database that users can search through, based on recipeName and recipeIngredients. When they search, the results are displayed as an array of the recipeNames.
I’d like to make each element in the array a link to a single page, display_recipe, that will display the rest of the recipe information (ingredients, preparation, etc).
I suspect I’ll need to use the _GET or _POST method somehow, but I’m not sure if that’s the best way to do it, or how to implement it if it is.
Any help (and specific code examples!) would be greatly appreciated.
By: ~*Stephanie S
How to use modulus division % in a C program?
using modular division (%),,,,,,,,,,,
pls tell me the code in C……….
iam confused b’coz using array is not permitable………..
By: smartboy
I am in desperate need of help with this C code and why it fails to work?
#include
#include
#include
#include
void vowel (const char * string);
void reorder (int n, char *x[]);
int main ()/* Main Function */
{
const char * random = “\nThis is a test run.”;/* Const Char string passed as variable random */
printf(random, “%s”);/* Output Statement of ‘random’ */
vowel(random);/* Calling function ‘vowel’ */
const char * myname = “\nMy name is Shiva Devarinti.”;/* Const Char string passed as variable myname */
printf(myname, “%s”);/* Output Statement of ‘myname’ */
vowel(myname);/* Calling function ‘vowel’ */
const char * university = “\nI go to Binghamton University.”;/* Const Char string passed as variable university */
printf(university, “%s”);/* Output Statement of ‘university’ */
vowel(university);/* Calling function ‘vowel’ */
static char *x[2] = { “Tr2o3phy”,”Sho2e”};/* Declaration of array of two pointers */
static char *y[2] = { “Artificial”,”Art”};
static char *z[2] = { “zoom”,”Shoe”};
int i;
printf (”\nThe entered strings are:\n”);/* Outputs the entered strings */
for (i = 0; i < 2; ++i)
{
printf ("%s\n", x[i]);
}
printf ("\nThe entered strings are:\n");
for (i = 0; i < 2; ++i)
{
printf ("%s\n", y[i]);
}
printf ("\nThe entered strings are:\n");
for (i = 0; i < 2; ++i)
{
printf ("%s\n", z[i]);
}
int n = 2;
reorder (n, x);
reorder (n, y);
reorder (n, z);/* Sort and reorder the list of strings */
printf("\nThe reordered string is:\n");
for (i = 0; i < n; ++i)
{
printf("\n %d: %s\n", i + 1, x[i]);/* Display the reordered list of strings */
}
printf("\nThe reordered string is:\n");
for (i = 0; i < n; ++i)
{
printf("\n %d: %s\n", i + 1, y[i]);
}
printf("\nThe reordered string is:\n");
for (i = 0; i < n; ++i)
{
printf("\n %d: %s\n", i + 1, z[i]);
}
return 0;
}
void vowel (const char * string)/* Function declaration */
{
int count = 0;/* Variable 'count' Declaration and Initialization */
int store = 0;/* Variable 'store' Declaration and Initialization */
while ( string[count] !='\0')/* Beginning of while loop */
{
/* If an upper case or lower case vowel is encountered add to the variable 'store' and increment it */
if (string[count] == 'A')
++store;
if (string[count] == 'a')
++store;
if (string[count] == 'E')
++store;
if (string[count] == 'e')
++store;
if (string[count] == 'I')
++store;
if (string[count] == 'i')
++store;
if (string[count] == 'O')
++store;
if (string[count] == 'o')
++store;
if (string[count] == 'U')
++store;
if (string[count] == 'u')
++store;
++count;
}
printf ("\nThe Number of vowels in the above sentence are %i.\n", store);/* Output Statement */
}
void reorder (int n, char *x[])
/* Function Declaration */
{
char *temp;/* Variable Declaration */
int i, item;
for (item = 0; item < n - 1; ++item) {
for (i = item + 1; i < n; ++i) {
if (strcmp (x[item], x[i]) > 0) {/* Swapping the strings */
temp = x[item];
x[item] = x[i];
x[i] = temp;
}
}
}
return;
}
By: sesh48
PHP - Character Limit in a table array?
When you click on the application number, you can see everything that they filled out and at the bottom there is a text box that staff can write comments in (”i like them,” “they’re awfully young,” etc.).
I have the comments showing on the list page, but I don’t want it to be everything, cause the one column gets really big.
I tried the ’substr’ thing to limit the $comm variable to 20 characters, but nothing happened. i don’t know if you can even use that on a mysql_fetch_assoc. I want it to stop after about 20 chars, and have a ‘….’ at the end, if possible.
Is there any way to only show the beginning of the staff comment? I dont know if i can change the variable, or can I limit the amount of text that the
I cant find anything online and i’m still fairly new to php. I’ve been using it for over a year, but this is the first time I’m actually writing my own codes to put into my site. =X
Thanks In Advance
By: Jayy T
1 Comment
how can i write a search engine in perl and display the result in html?
By: pravin k
I need a function-oriented program that will compute the sum,average,and sort from descending to ascending?
I really need the code for this program. A function-oriented program that when i enter 10 numbers, i can get the sum,average,another operation is to sort those number from descending to ascending and last function i need is searching array by using linear search. Please help me. Thank you so much.Godbless!!
By: bridjE









