Using three tuple representation of a sparse matrix?
#include<stdio.h> #include<unistd.h> #define SIZE 3000; void main() { int a[5][5],row,columns,i,j; printf("Enter the order of the matrix(5*5)"); scanf("%d %d",&row,&columns); printf("Enter the element of the matrix\n"); for(i=0;i<row;i++) for(j=0;j<columns;j++) { scanf("%d", &a[i][j]); } printf("3-tuple representation"); for(i=0;i<row;i++) for(j=0;j<columns;j++) { if(a[i][j]!=0) { printf("%d %d %d", (i+1),(j+1),a[i][j]); } } getchar(); }
/* Discrete Fourier Transform and Power Spectrum Calculates Power Spectrum from a Time Series Copyright 1985 Nicholas B. Tufillaro */ #include #include #define PI (3.1415926536) #define SIZE 512 double ts[SIZE], A[SIZE], B[SIZE], P[SIZE]; main() { int i, k, p, N, L; double avg, y, sum, psmax; /* read in and scale data points */ i = 0; while(scanf("%lf", &y) != EOF) { ts[i] = y/1000.0; i += 1; } /* get rid of last point and make sure # of data points is even */ if((i%2) == 0) i -= 2; else i -= 1; L = i; N = L/2; /* subtract out dc component from time series */ for(i = 0, avg = 0; i < L; ++i) { avg += ts[i]; } avg = avg/L; /* now subtract out the mean value from the time series */ for(i = 0; i < L; ++i) { ts[i] = ts[i] - avg; } /* o.k. guys, ready to do Fourier transform */ /* first do cosine series */ for(k = 0; k <= N; ++k) { for(p = 0, sum = 0; p < 2*N; ++p) { sum += ts[p]*cos(PI*k*p/N); } A[k] = sum/N; } /* now do sine series */ for(k = 0; k < N; ++k) { for(p = 0, sum = 0; p < 2*N; ++p) { sum += ts[p]*sin(PI*k*p/N); } B[k] = sum/N; } /* lastly, calculate the power spectrum */ for(i = 0; i <= N; ++i) { P[i] = sqrt(A[i]*A[i]+B[i]*B[i]); } /* find the maximum of the power spectrum to normalize */ for(i = 0, psmax = 0; i <= N; ++i) { if(P[i] > psmax) psmax = P[i]; } for(i = 0; i <= N; ++i) { P[i] = P[i]/psmax; } /* o.k., print out the results: k, P(k) */ for(k = 0; k <= N; ++k) { printf("%d %g\n", k, P[k]); } }
Which os is build in Java compiler?
Java compiler available on multiple platforms, the class files it generates are platform-independent.
How do you write a program to make asterisk isosceles triangle using for loop in c plus plus?
*
**
***
****
simply use dis...
{
int x,y;
for(x=1;x<=4;x++)
{
for(y=1;y<=x;y++)
printf("*");
printf("\n");
}
}
What is low-level symbolic programming language?
In contrast to a high-level language, which formats itself more to allow the programmer to understand his/her work and program flow, a low-level language formats itself in terms of a computer's or circuit's own internal structure. Rather than you saying what you want to do and letting the compiler figure out how to tell the machine what to do, you're basically telling the machine directly what to do: in its own "words," so to speak.
Assembler languages are perhaps the best-known low-level languages.
Can a class c felon go to Mexico?
Anyone looking toescape the US can go to Mexico. They have no strict importation laws on anything, anyone.
Added: However. . . Mexico DOES have an extradition treaty with the US.
#include<stdio.h>
int main()
{
int d,j=1,i,flag=0,count=0,k=0;
int b[];
char a[],c;
printf("enter the number=");
scanf("%s",a);
printf("enter the digit=");
scanf("%c",&c);
printf("the place value of given digit is:");
for(i=0;a[i]!='\0';i++)
{
if(a[i]==c)
{
b[k]==a[i]-'0';
b[k]=b[k]=*j;
flag=1;
count++;
k++;
}
j=j*10;
}
if(flag==1)
{
printf("the place value of given digit %c is:",c);
for(i=0;i<count;i++)
printf("\n%d",b[i]);
}
else
printf("your entered digit is not present in number");
return 0;
}
What is the difference bw cached memory and uncached memory?
Cached memory is read each time the file is read. This can increase the computers performance. Uncached memory is not read each time.
The Bourne Again Shell (bash) was originally written by Brian Fox. It is maintained as part of the GNU project and has several developers, now led by Chet Ramey.
C program to duplicate element from a set of elements?
Cannot be solved without knowing what an 'Element' is.
In IT What is the difference between a user variable and a system variable?
A user variable is a memory which is used in specific function or functionality. A system variable is kinda of generic, accessible to all users of the system. It does not bind to specific process as such.
How do you get an A plus in class when im a C?
To get an A+ in class when you are a C, you work very, very hard and get all A+'s from here on end.
Unfortunately, if the professor grades on the average of all your work, your C status might prevent you from becoming an A student, particularly if you are near the end-of-term. Talk to the professor.
Often, C status is an indication of inability to meet the demands of the work. This could be due to not being prepared to do the work, being overloaded with coursework, or not being committed to doing the work, possibly due to the tendency to party, drink, do drugs, etc.
If the latter is true, and you really want an A, you have some hard decisions to make. Talk to your Counselor. School is not a party. School is a job, and your job is to work at school and do well enough to be recognized by potential employers.
Sorry for the preaching, but it is true. The first two "inabilities" applied to me, though I knew many to which the third "inability", partying, brought them down. Now I pay for it by not having a degree. Even though I am a successful engineer, some things are out of my grasp because of the lack of the degree.
Note: You have to concentrate on what you are doing, for example if you ask a question about grades, please make sure you don't put it in the 'Programming' category.
How do you know whether the function is 'user define' or 'library functions'?
If you have written it yourself, then it is the former, otherwise it is the latter.
What OS is the other machine, and what program are you running? I believe Sun uses a different architecture than most other machines, but I can't remember off the top of my head.
MFC is the Microsoft Foundation Class library which provides the Windows Application Framework Extensions (AFX). The library is really nothing more than a class wrapper to make it easier to work with the Windows API using C++ classes. Although still used today it has largely been replaced by the .NET framework.
How do you write roulette program in C?
try this:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define MAX_LINE_LEN 80
#define WS1 " \t$"
#define WS2 " \t"
#define N_MAX 36
const char *p0 = "How much money do you have?";
const char *p1 = "Enter 1 for odd, 2 for even";
const char *p2 = "Place your bet";
typedef enum { false = 0, true } bool;
int getInt(const char *prompt, const char *ws);
int main(int argc, char *argv[]) {
time_t t;
int balance, bet, choice, ball;
bool betOk, win;
srand((unsigned)time(&t));
balance = getInt(p0, WS1);
while (balance > 0) {
do {
choice = getInt(p1, WS2);
} while ((choice < 1) (choice > 2));
for (betOk = false; betOk false) {
printf("invalid input, try again: ");
}
}
return z;
}
What is the Syntax of remainder operator in c language?
% = Shift + 5
Example:
printf ("7%%3=%d\n", 7%3);
result: 7%3=1
one more thing this operator works only with integer type numbers not floating numbers.