473,387 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

In my program my fgets funtion wont read inputs when i execute program...whats wrong

/* I didnt copy my functions on here so it wouldnt be as long if those could be the problem ill copy those as well */


#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#define N 20
#define M 5
#define A 10
int* array( int *arr , int size );
int median( int* arr );
void sort( int arr[] , int k );
int* merge( int* array1 , int* array2 );
void upper( char* str );

int main(void){
char string [80] ;
int array1[N];
int j;
int i;

int ARRAY1[10];
int ARRAY2[10];
int med[M];


printf(" Hello this program is going to do 6 different funtions \n" );

printf(" Can you please type up to 20 numbers \n");

for( j = 0 ; j < N ; j++ ){
scanf( "%d", &array1[j] );
}
array( array1 , N );

printf( " \n Now can you please type in 5 integers so we can calculate the median of them \n " );

for( i = 0 ; i < M ; i++ ){
scanf( "%d" , &med[i] );
}
sort( med , M );
median( med );
printf( " Can you please type in 10 elements for array 1 from least to greatest\n ");
for( i = 0 ; i < 10 ; i++ ) {
scanf( "%d" , &ARRAY1[i] );
}

printf( " Can you please type in 10 elements for array 2 from least to greatest\n ");
for( i = 0 ; i < 10 ; i++ ) {
scanf( "%d" , &ARRAY2[i] );
}





merge( ARRAY1 , ARRAY2 );
printf( "Enter in a sentence : " );


fgets ( string , 81 , stdin );
May 2 '10 #1
2 1595
Oh and i did put the "}" to terminate the main function just accidently left that out in the copy
May 2 '10 #2
weaknessforcats
9,208 Expert Mod 8TB
Have you considered displaying the string array after the fgets call?
May 3 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Chris Geerdink | last post by:
combo with PHP. what is wrong with the Javascript? else { include("mysql.php"); $query1 = mysql_query("INSERT INTO gbook (naam, email, text) VALUES ('".$_POST."', '".$_POST."',...
4
by: asdf | last post by:
Hello! Can someone tell me whats wrong with this piece of code: Option Compare Database Option Explicit Sub retrieve() Dim rst As ADODB.Recordset Dim i As Integer
1
by: aa | last post by:
When I am reading from local disk (d:), everithing is OK, but then I am reading from map disk I am geting the this error. Whats wrong. Thanks Server Error in '/Extra' Application....
7
by: Mike Barnard | last post by:
It's a simple test... VERY SIMPLE. But... In an external stlyesheet some attributes don't show. With the same styles cut and pasted to the test internally it works as expected. Anyone tell...
2
by: =?Utf-8?B?VkIgLk5FVCBSb29raWU=?= | last post by:
I am creating an application and now when I try to run my program the forms open as Read Only and I can't type any text into my text boxes. How do I change this back to normal???? Thanks in...
1
by: Varun Gupta | last post by:
PATH="/clocal/mqbrkrs/user/mqsiadm/sanjay/" MAIL_RECIPIENTS="rb903@dcx.com" Subject="File accessed in last minutes:" find "$PATH" -type f -amin -1 > temp.txt.$$ cat temp.txt.$$ | \ while read...
0
by: cuddles | last post by:
hi im using IBM DB2 version 8 i have a procedure that should delete an error log table DELETE FROM TABLE1.ERR_MSG_LOG WHERE DATE(CRT_S) < (CURRENT DATE - 30 DAYS); but i keep...
5
by: islayer | last post by:
can someone tell me what is wrong with the bold code? i am just learning perl. the program should create a perl file with a random name (5 letters, followed by a number), but the name is always just...
1
by: x40 | last post by:
I try to learn python thru solving some interisting problem, found google trasure hunt, write first program ( but cant find whats wrong). # Unzip the archive, then process the resulting files to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.