Monday, July 27, 2009

Plz can u give me some C-programs related to arrays. plz i have homework .....?

which starts with ...... #include%26lt;stdio.h %26gt;


I need about 10 programs,,,, I will be very thankful

Plz can u give me some C-programs related to arrays. plz i have homework .....?
/* Introducing array's, 2 */


#include %26lt;stdio.h%26gt;





main()


{


char word[20];





word[0] = 'H';


word[1] = 'e';


word[2] = 'l';


word[3] = 'l';


word[4] = 'o';


word[5] = 0;


printf("The contents of word[] is --%26gt;%s\n", word );


}








Sample Program Output


The contents of word[] is Hello











include "stdafx.h"


#include %26lt;iostream%26gt;


#include %26lt;cmath%26gt;


#include %26lt;conio.h%26gt;


using namespace std;





int main()


{


const int TEMPERATURE = 120;


float ave = 0.0;


float sdev = 0.0;


int temp_read;


int read[TEMPERATURE];





do


{


cout %26lt;%26lt; "Enter the number of Temperarure readings [1-120]: ";


cin %26gt;%26gt; temp_read;


if ((temp_read %26lt; 1) || (temp_read %26gt; TEMPERATURE))


cout %26lt;%26lt; "Incorrect choice. Try again... \n";


} while ((temp_read%26lt; 1) || (temp_read %26gt; TEMPERATURE));





for (int i = 0;i %26lt; temp_read;i++)


{


cout %26lt;%26lt; "Enter the temperature reading#" %26lt;%26lt; i+1 %26lt;%26lt; ": ";


cin %26gt;%26gt; read[i];


ave = ave + read[i];


}





ave = ave / temp_read;





cout %26lt;%26lt; "The average of all the temperature readings is: " %26lt;%26lt; ave %26lt;%26lt; "\n";





for (int i = 0;i %26lt; temp_read;i++)


{


sdev = sdev + (read[i] - ave)*(read[i] - ave);


}


sdev = sdev / temp_read;


sdev = sqrt(sdev);





cout %26lt;%26lt; "The standard deviation of all the temperature readings is: " %26lt;%26lt; sdev %26lt;%26lt; "\n";





cout %26lt;%26lt; "Press any key to continue..";





_getch();


return 0;


}





check this link for more and clear details
Reply:go to c programming .com u might get some
Reply:Dear Kiran





Every program in C starts with #include%26lt;stdio.h%26gt;


So read your C-Language Text Book or visit my old website


http://www.megasoft.4t.com/tutorials.htm
Reply:I am sorry to help u with a few programs is ok but to create abt 10 programs and send it to u is foolish and a waste of time. If u want help u r welcome to ask anything.


No comments:

Post a Comment