Hi all,
I've got a website with the install function, and the install want the safe_mode to be off but my web hosting company wouldnt turn safe modee off, is der a way to get around this?
Can I add something to my code?
Please Help!!!
Hi all,
I've got a website with the install function, and the install want the safe_mode to be off but my web hosting company wouldnt turn safe modee off, is der a way to get around this?
Can I add something to my code?
Please Help!!!
Thank you guy, my bad, I corrected it in the wrong place. Works now.
> scanf( "%d",year);
You need &,
as inscanf( "%d", &year);
You should also start using a compiler which will warn you about printf / scanf format string errors before you get to run your code and have it fail in a variety of interesting ways.gcc -W -Wall -ansi -pedantic -O2 prog.c
is usually a revelation the first time you try it
This is my code.
if (r <=-.9)
{
printf("Data are linearly correlated: r = %1.3f\n",r);
printf("What year do you want to predict? ");
scanf( "%d",year);
predict = a + b*year;
printf("Predicted index in year %d is %lf", &year, predict);
}
else if (r >-.9)
{
printf("Data are not linearly correlated: r = %1.3lf\n",r);
printf("Stopping");
}
This is the output that i get
Data are linearly correlated: r = -0.985
What year do you want to predict? 2010
predicted index in year 2293448 is -6710792614
The problem is when i re print 2010 the output it 2293448.
WHY???
[IMG]C:\Documents and Settings\Hamid\Desktop\int.gif[/IMG]
int year;
if (r <=-.9){
printf("Data are linearly correlated: r = %1.3f\n",r);
printf("What year do you want to predict? ");
scanf( "%d",year);
predict = meany + b*year;
printf("Predicted index in year %d", year);
}
Its just not normall that this happens.
Shouldn't the year be an integer. Therefore shouldn't you be using %d?
Yes I tried making year an int and used %d, but then the program crashed...
Any other ideas why?
In the below code im getting a year from the user. but when I print of the year from scanf is doesnt print the correct value such as 2010 will be printed as 74.43434 (somthing like this).
If i change the scanf from %.3lf to %f or %d the program will crash.
ANY IDEAS ANYONE?
double year;
if (r <=-.9){
printf("Data are linearly correlated: r = %1.3f\n",r);
printf("What year do you want to predict? ");
scanf( "%.3lf",year);
predict = meany + b*year;
printf("Predicted index in year %.3lf is %lf", year, predict);
}
else
printf("Data are not linearly correlated: r = %lf\n",r);
printf("Stopping");
Hi All,
I've written a program, it has a main and lots of functions. Now i need to make a project from the code.
Could some tell me what to do.
I want a main.c a misc.c and misc.h. Which parts of the program would go in each one?
Thank you,
ok, here is example code
void print(int x, int y) { cout << x << " " << y << "\n"; } void calculate( int* meanx, int* meany) // The two parameters are pointers to the integers that // are declared in main() { *meanx = 1; *meany = 2; } int main() { int meanx = 0; int meany = 0; calculate(&meanx, &meany); print(meanx, meany); }
Can u show me in this code, I still didnt quet grasp it.
#include <stdio.h>
#include <string.h>
#include<stdlib.h>
typedef struct
{
unsigned int larray;
double *x;
double *y;
}data;
double getArrayBar( double *array , int length ) ;
data getdata(const char file[]);
double corr(data data_sm);
int main(void)
{
data data_sm;
char filename[20];
printf("\nEnter the file name : ");
scanf("%s",&filename);
data_sm = getdata(filename);
corr(data_sm);
return 0;
}
double getArrayBar( double *array , int length )
{
double sum = 0 ;
for ( int i = 0 ; i < length ; i++ )
sum += array[i] ;
return sum/length ;
}
data getdata(const char file[])
{
data d;
int i=0,j=0;
FILE *inputFile;
double meanx, meany;
/*double a[200],b[200];*/
d.x = 0;
d.y = 0;
inputFile = fopen(file,"r");
if(inputFile == NULL)
{
printf ("Error opening data file \n");
exit(1);
}
do
{
d.x = realloc(d.x, (i+1)*sizeof(double));
d.y = realloc(d.y, (i+1)*sizeof(double));
i++;
if(!d.y || !d.x) {
printf("Allocation Error\n");
exit(1);}
}
while(fscanf(inputFile,"%lf %lf",&d.x[i-1],&d.y[i-1]) == 2);
meanx = getArrayBar (d.x , i -1 );
meany = getArrayBar (d.y , i -1 );
printf("X bar is %lf\n", meanx) …
Im codding a programm that has multiple functions.
Once functions calculates the means of 2 sets of data and prints meanx and meany.
Now another function will use those means to do some other calculation.
I dont know how to get those values from one function and pass them into another?
Can anyone help me here??
Thank you
You wouldnt be able to find a book to cover the whole Internet for you.
Every single programing language that you know of and every single server that you know of is connected to the Internet. So you'll need so start from how to create simple website (XHTML, CSS), then get into getting that site to do something (ASP.NET, PHP, JavaScripts), then you want info from that site to be stored in a Database (SQL, postgrass) once you got a site that is working then you get into hosting it on the Internet. You also need to know about networking and how IPs and DNS works. Its such a broad topic that it's impossible to cover in one go.
HI Guys,
Im running xampp as a testing environtment and want to be able to show it to some clients. Is it possible to use xampp as my server and access it via my DNS?
Im sitting behind a NAT router?
I've done the static LAN IP and forwarded port 80 to my computer on the router.
Any help would be appreciated.
Try this admin tool, it has lots of tools within. You can test pretty mush all hardware.
http://www.mininova.org/tor/435381
But you need a torrent client.
You can do a repare with the burnt XP cd. Just select repare at the first option when it asks you, dont repare on the second option otherwise you'll be installing XP again with the burnt CD. Also check your HDD, monitor your temp so it doesnt get too hot. Check ur RAM and motherboard.
I'd say the documents are kept on the serve only unless you have enabled offline files option.
If your using AD for user to login then you dont need to worry about the PC, because AD will redirect the users to there home directory(my documents) where ever in the network they login.
I'm not sure about this warm and cold thing.
But use the xp CD to repair the installation (if it reboots constantly)
Test you HDD and memory and if you can also the motherboard (there are admin tools you can d/l and use that to test your hardware).
It could also be a faulty RAM stick.
Use an Admin tools software to test your RAM modules.
Hi,
Im reading a file, with 2 columns. this is working
such as
1999 5848946
2000 5458445
2001 5757585
2002 7699865
2003 7459758
2004 5797054
as Im reading I want to be able to count how many rows I've read and also add the all values as im reading from the second column, could some help plz
This is the code
#include <stdio.h>
#include <stdlib.h>
struct data{
int x;
int y;
};
void read_info(void);
int main()
{
read_info();
}
void read_info(void)
{
FILE *stocks;
struct data stock;
int x;
char buf[80];
int total = 0;
int numberofrecords = 0;
stocks = fopen("banana.dat", "r");
if(stocks==NULL)
{
puts("No data in file");
return;
}
while (fgets(buf, 80, stocks) != NULL && !feof(stocks))
{
sscanf(buf, "%d %d", &stock.x, &stock.y);
printf("n1 = %d n2 = %d\n", stock.x, stock.y);
/*numberofrecords = stock.x++;
total += stock.y;
printf("%d %d", numberofrecords, total);*/
}
fclose(stocks);
}
Hi Guys,
I'm trying to read a while with the following formate
1999 43558047
2000 59068567
2001 67098709
.........................
...........................
I'm not sure how many records are in the file.
Now I want to read this file using
struct mystruct {
double x; //this would be first column
double y;//this would be second column
and I want to the store the values in arrays, so later on I can use some sort of calculations how to i go about it?