Adak 419 Nearly a Posting Virtuoso

Depends (and I hate to go "Clinton" on ya) ;) what your definition of "merge" is.

Joey's post showed an interleaving of char's, so if your arrays were thus:

char a[] = {"acegikmoqsuwy"};
  char b[] = {"bdfhjlnprtvxz -- It's working"};
  char c[80] = {'\0'};

You would wind up with the correct alphabet in c[] + " --It's working"

And of course, you can do this with just integers for indeces, and without using string h.

The whole program I described is 29 lines of code, including the #include line for stdio.h, and explicit lines for ++i and ++j, and the printout at the end. I just wrote it to clear up a nagging thought I had.

Works fine.

Ancient Dragon commented: Yes you are right. I had not noticed that. +28
Adak 419 Nearly a Posting Virtuoso

Hello.

I would very much appreciate if someone would aid me with a hint.
My problem is as follows :
read two arrays of chars and merge them into a third array like so :
ARR1 :123abc
ARR2: rt678iogl
ARR3:1r2t36a7b8ciogl

The problem must be solved without pointers and string.h

Basically Im stuck at the the above merging procedure. I myself am not a very experienced programmer as you can notice, but a hint in the right direction would be very much appreciated. No code please .
Thank you very much !

Three states have to be handled:

1) array1 has more letters than array2
2) array2 has more letters than array1
3) both arrays have the same quantity of letters.

It's very useful to use one int variable as the iterator and index for the smaller arrays, and use another int variable as the indexer for the merged array3.

i and j set to 0 before the loop starts is good
then a
start your while loop
testing first that both array's have not reached the end of string char: '\0'

if either array has reached it's end, break out of the while loop, and remember which one still has data, by using a flag value on a variable: go1 or go2, maybe.

then set the values from array1 into array[3], increment j, and do the same with values from array2, and increment j …

Adak 419 Nearly a Posting Virtuoso

You need to look at what is common for all the data lines. One thing they all have, is a space (or two or three, maybe a small tab), between the hours numbers, and the meter reading.

Another thing you might notice, is that the hours entry always uses two digits, after the colon. The next digit after those two, is always the first digit of the meter reading.

Another idea (not tested, but probably true), is that the meter readings are formatted like this, on the input line:

[H]H:MM   DDDDD\n

Where [H]H is an [optional] hour, followed by a mandatory hour, then a colon and two minute digits.

Then the spaces or tab. Then the meter digits, immediately followed by the newline char: '\n', which you can't see. So, in all liklihood, the meter reading are the digits immediately before the newline char,

Which gives us this:

spaces DDDDD \n, without any real gaps. Clearly, the meter readings take up the last 5 digits, if you worked backward from the end of the line, and stopped at the space.

So you have several ways to find your meter readings, and then it's just a matter of putting them into your array.

I would recommend a while loop (because you don't know how many rows of data there might be), and fgets() to put the data into a char str[50] = { '\0' };

From there, pick out any way you …

Adak 419 Nearly a Posting Virtuoso

You don't need us to try and fill in a books worth of info, on image compression. Use Google and be prepared for a lot of reading.

There are dozens of image compression formats already developed. Why do you need a new one?

It's not like these formats are worn out after you use them for a few images, or something. ;)

You may want to also visit the newsgroups, google, and yahoo groups that work with images and especially their algorithms and processing for compression/decompression. Usually for something this technical, I'd head for google, and then go hunting for the right newsgroup that specializes in it.

Good luck!

Adak 419 Nearly a Posting Virtuoso

Welcome to the forum, Qwerty_touch.

The way it works is, you show what you've got started on the problem/project, and tell us what has you stopped from completing the program.

Requesting some work and involvement from the posters, knocks off the "code leeches", who just want their program done for them, for free.

Adak 419 Nearly a Posting Virtuoso

I tried compiling, but I got an error:

scan.c: In function ‘main’:
scan.c:34: warning: incompatible implicit declaration of built-in function ‘memcpy’

What is this memcy function?

Sorry for that. My compiler has a "smart" feature which will add in parts of other header files, if it see's that they're needed.

Add this line:

#include <string.h>

to the top of the program.

memcpy() copies a bit of memory from one address or variable, to another.

Adak 419 Nearly a Posting Virtuoso

Hmm, I was trying to load strings from a file(formated) to an 2D Array... but....

int j;               //new
FILE * fp;
char TempBuffer[101];
char array_game[100][100];
fp=fopen(filename,"r");
for(i=0; i<100; i++)		// Create 2D array to Hold the array of the file
{	
	for(j=0; j<100; j++)					
	{
			fgets(TempBuffer,100,fp);		
                        TempBuffer[100] = '\0';
			strcpy(&array_game[i][j],TempBuffer);		
                        TempBuffer[0] = '\0';
	}
}

That will remove the newline char from the end of TempBuffer, and give you a bit of defensive programming, as well.

The char's that fgets() can have at the end ('\n' and '\0'), can be a problem.

Adak 419 Nearly a Posting Virtuoso

Tots08:

You have to know the basics of printing out a char array, and putting a value into a char array, or you can't do a program on Conway's Game of Life - because that's the heart of the program, right there.

You need to hit the books, and /or run through some basic C tutorials on the net. You also need to get yourself rested, and ready to learn from your lecturer. You're not being fair to yourself, if you're not set up and ready to do your best with your studies.

Adak 419 Nearly a Posting Virtuoso

OK, let's go with "moving around". ;)

If your compiler has the header file "conio.h", then the problem is trivial.

This program shows how to pick up the scan codes from a keyboard
These define the scan codes(IBM) for the keys. All numbers are in decimal.

#include <stdio.h>
#include <conio.h>

#define ESC 27
#define F1 59
#define F2 60
#define F3 61
#define F4 62
#define F5 63
#define F6 64
#define F7 65
#define F8 66
#define F9 67
#define F10 68
#define HOME 71
#define UP 72
#define PAGE_UP 73
#define LEFT 75
#define RIGHT 77
#define END 79
#define DOWN 80
#define PAGE_DOWN 81

int main(void) {

  char key;
  char msg[20];
  printf("\n\n\t\t\t     press escape to quit\n\n") ;
  do {
    key = getch();
    if (key == 0) {
      key = getch(); //key code has two keys - read the second one
      switch (key) {
        case F1: memcpy(msg,"F1", sizeof(msg)); break;
        case F2: memcpy(msg,"F2", sizeof(msg)); break;
        case F3: memcpy(msg,"F3", sizeof(msg)); break;
        case F4: memcpy(msg,"F4", sizeof(msg)); break;
        case F5: memcpy(msg,"F5", sizeof(msg)); break;
        case F6: memcpy(msg,"F6", sizeof(msg)); break;
        case F7: memcpy(msg,"F7", sizeof(msg)); break;
        case F8: memcpy(msg,"F8", sizeof(msg)); break;
        case F9: memcpy(msg,"F9", sizeof(msg)); break;
        case F10: memcpy(msg,"F10", sizeof(msg)); break;
        case PAGE_UP: memcpy(msg,"PAGE UP", sizeof(msg)); break;
        case PAGE_DOWN: memcpy(msg,"PAGE DOWN", sizeof(msg)); break;
        case HOME: memcpy(msg,"HOME", sizeof(msg)); break;
        case END: memcpy(msg,"END", sizeof(msg)); break;
        case UP: memcpy(msg,"UP", sizeof(msg)); break;
        case DOWN: memcpy(msg,"DOWN", sizeof(msg)); break;
        case LEFT: memcpy(msg,"LEFT", sizeof(msg)); break;
        case RIGHT: memcpy(msg,"RIGHT", sizeof(msg)); break;
        default:  memcpy(msg,"unknown key", sizeof(msg)); break;
      }
      printf("\n Key: …
Adak 419 Nearly a Posting Virtuoso

With nested loops, the comparisons become:
a to a[j]
==========
a[0] to a[1]
a[0] to a[2]
a[0] to a[3]
a[0] to a[4] <<j loop exits, after this comparison
a[1] to a[2]
a[1] to a[3]
a[1] to a[4] << j loop exits again, after this comparison
a[2] to a[3]
a[2] to a[4] << j loop exits again, after this comparison
a[3] to a[4] << last break out from the j loop, because j is no longer < 5
Now, the i loop breaks out because i is no longer < 5
============================================
End of Selection sort of 5 values

I've noticed that you're having trouble with these basic concepts of loops, etc.

Study up, because most posters, will not have the time or the patience, to write up answers like this. That includes me, as well.

Adak 419 Nearly a Posting Virtuoso

I have run out of patience with this thread.

Adak 419 Nearly a Posting Virtuoso

That's what I though! But then you posted about two players with two connected PC's playing the game, I did a **TILT**. ;)

So there is going to be *one* player playing against the computer, RIGHT?

And that one player is going to enter his choice of where to attack on the battle grid, via the keyboard, correct?

Adak 419 Nearly a Posting Virtuoso

puts() adds a newline char to the end of the string. printf(), doesn't do that.

Best way to understand your code is to step through it with the debugger, and watch the value of b(). Then you can see exactly what strncpy() is doing.

The first 7 char's in a() are *not* a null terminated string - they're just 7 char's, and that's not the same thing, at all. With C if you want to deal with strings, you need to ensure that your would-be strings are always terminated with the end of string char: '\0'.

Adak 419 Nearly a Posting Virtuoso

This is the sorting portion of your code, from above:

for(i=0;i<5;i++)
   {
       for ([B]j=0;[/B]j<5;j++)
       	 {
      	 if(num[i]>num[j])
       		 {
	         temp=num[i];
        	 num[i]=num[j];
	         num[j]=temp;
       		 }
    	 }
   }
/* 
and this is the same code, optimized. It is called Selection sort (goto Wikipedia for a whole page on it).
*/
   for(i=0;i<5;i++)
   {
       for ([B]j = i + 1;[/B]j<5;j++)
       	 {
      	 if(num[i]>num[j])
       		 {
	         temp=num[i];
        	 num[i]=num[j];
	         num[j]=temp;
       		 }
    	 }
   }
Adak 419 Nearly a Posting Virtuoso

.the player is not supposed to enters where he will hit...

???

Adak 419 Nearly a Posting Virtuoso

In your sorting code, when j is less than, or equal to i, the comparisons are wasted - they're already sorted at that point.

So, in the inner loop:

//same for loop as before, right here
for(j = i + i, j < 5; j++) {

  // same code as before in here
}

will do the same job, quicker. ;)

This, btw, is called Selection sort.

Adak 419 Nearly a Posting Virtuoso

What's the flow of this game supposed to be? With the grids.

I get it if you, and the opponent, have their own paper (gasp!), or separate screen.

But if you're using a PC with just one desktop screen, then what?

Once peek at your grid showing your ships position, and game OVER!

Adak 419 Nearly a Posting Virtuoso

What does "apantisi" and "apotelesma", mean?

Adak 419 Nearly a Posting Virtuoso

An easy way to find duplicates is to sort the list of names, that puts the duplicates right next to each other in the list. Then run through the list and if list == list[i+1], then you have a duplicate. Stop the search at one less than normal, or else list[i+1] will be out of bounds of the size of the array.

If you need to print up other info on these people, then you need to include that info and put it into a struct along with their other pieces of info, (recommended). If you haven't had structs yet, then you can use parallel arrays for this (works, but it's not nearly as elegant).

Let's start a new thread with a better topic, if you want help with structs or parallel arrays. "Binary Search" is misleading, and that problem is solved.

Adak 419 Nearly a Posting Virtuoso

The compiler is complaining because you have not given it a prototype for the runner function.

Adak 419 Nearly a Posting Virtuoso

Welcome to the forum manju_b.

A few suggestions on using this forum:

1) Don't post onto a thread that is more than 3 months old. Start a new thread, instead.

2) Always post any code, inside code-tags, so it looks like a program and not all squashed to the left side margin.

3) Enjoy the forum!

Google "Borland Legacy Programs", and you'll get the link to the legacy C/C++ compilers.

As for setting it up, just remember that it's not a Windows program, (at least the early versions are DOS), so follow the directions that come with it, and do not use any Windows installer, unless it comes with one, and says to use it.

My version of turbo C/C++ just goes in a directory called C:\TC, and from there, it made all the other directories that are below it.

In the C:\TC directory, you'll have a "readme.com" file. Double click on it, and it has all the info in it, except the window problem of getting it to work in the full screen.

After that just find your TC.exe file and right click on it, select "create shortcut", and drag the shortcut onto your desktop, and you'll be good to go.

You may have to adjust the properties of your console window for TC. At least, I did. You want the full window to be used, not the adjustable one, and you have to lower your buffers and window size, so your system can fit it in (but not …

Adak 419 Nearly a Posting Virtuoso

I have already taken the English version, of your program, and made several corrections to it.

But I can't test it to see if it'll work, without the 1.txt, 2.txt, and or 3.txt file(s).

Can you post?

Adak 419 Nearly a Posting Virtuoso

Your program looks very different than other Sudoku programs that I've seen.

Very interesting - no mention of "possible" numbers for any square, and no customary solving logic, either.

I'm very curious what the solving times for this will be!

Adak 419 Nearly a Posting Virtuoso

Marios, if you'll post a sample input file for your program, I can test your program out, and see what's up with it.

Adak 419 Nearly a Posting Virtuoso

Lots of nice ways to handle this. A simple approach is just a counter:

int unsolved = 81 - number of given numbers

Then when you solve another square: unsolved--;

That gives you a simple

while (unsolved) {

/* all your other code in here */

}

Adak 419 Nearly a Posting Virtuoso

This show one way of checking a peer group (row, column, or box), in Sudoku. (At least, it's a version that will make sense to you. The faster versions are rather opaque.)

int TestRows(int nudigit, int r)	{
	int c = 0;

	while(nudigit != A[r][++c] && c < 10);				  
	if(c < 10)
		return 0;  //nudigit failed
	return 1;

}	
/* adjust this to fit your own matrix */

The way it works is you only test one row at a time - if the nudigit fails, then there's no need to test any other rows, and no columns or boxes will be tested at all.

I haven't got a chance to study your code yet, but at first glance, it looks like you have a simple error, so don't gut it out and replace it with this code, until I get back and have some time to study it.

Box code requires the starting row and column and an small bit of arithmetic is all. More on that, later also. There are 9 boxes, and a small array tells you what boxNum fits which sqr. (a sqr is row * 9 + column), except the first row is just column).

switch (boxNum)
case 1: lrow = 0; lcol = 0; etc.

kind of a thing. I'll explain it later this evening.

Sudoku is an amazingly complex puzzle, despite it's simple outward appearance. The logical solving solutions are extremely subtle once you get past …

Adak 419 Nearly a Posting Virtuoso

The above looks wrong however.

For myColchar, You need to

1) change any lowercase letter the user may enter, to uppercase: use toupper() for that

2) subtract 'A' from your myColchar:, to make C into a 3, etc.: myColchar -= 'A';

The cast to an int doesn't do what you think if does. It just changes the SIZE of data, not the value. So if myColchar == 'A', the cast would leave you with 65 - (the ascii value of 'A'), which is the same value it had before the cast. Only the sizeof(myColchar) would have changed.

Then please post your code for any further bugs you find, so I can look at updated code, instead of old stuff.

Adak 419 Nearly a Posting Virtuoso

Very slick, Abhimanapal. ;)

Adak 419 Nearly a Posting Virtuoso

never mind i found wheri was wrong thnx guys u really helped me....!!!!
yet there is still the problem how can the user enters firstly the char and then the number with the same result.....any thoughts?

If you have one getchar() after each scanf(), then you know that there is no newline still in the KB (unless the player's cat walked across the keyboard ;) )

So getting the char first, will be no trouble:

scanf("%c", &ch);

and if you're next scanf() is for a number, then you don't need any

getchar(); //not needed at all
scanf("%d", &number);

because scanf() will pull off the newline char, and keep right on going, to find the number behind it, in the KB.

It's a bit confusing, but you get used to it - but it shows one big reason why scanf() is not a good choice for a real robust user input function.

Adak 419 Nearly a Posting Virtuoso

I agree, this is not up to snippet level, overall.

Adak 419 Nearly a Posting Virtuoso

Have you tried using a Hex Editor? (HexEdit is a freeware version, available at popular download sites like Toucow, etc.).

I'm not sure you can find what you want, however.

Adak 419 Nearly a Posting Virtuoso

Could it be ..

scanf("%s %d", &myColchar,&myrow);

What do you think?
;)

Mariosbikos -- slow down, please! You're ignoring perfectly good advice like the one above, from mitrmkar. myColchar is a char, and a char can never be a string, since it can't have enough room for an end of string char: '\0'.

So fix your scanf()'s, and leave the other stuff alone for now. Using scanf() for char's, is trickier than it looks, so I'm going to teach you how to do that, correctly.

When you enter anything with scanf(), you hit enter key at the end, so the keyboard buffer (KB), has a newline on the end of it.

For number scanf() (%d), that's no problem, because scanf() will pass right over any newline it runs into from the KB.

For char's, it's a WAY different story. The scanf() see's a '\n' (newline char), and say's "OK, I've got my char, leaving now", and it looks like your scanf() line of code was skipped entirely.

So, the thing to do is to pull the newline char's, after every scanf(), (when you have a char scanf() somewhere in the program), with a getchar(). Each getchar() will remove ONE char, and if you use it like this, it will do the job:

char ch;
int n;

scanf("%d", &n); //we get an int, but left a newline in the KB
getchar();     //we pull the newline char off the KB
scanf("%c", &ch); //now we can get …
Adak 419 Nearly a Posting Virtuoso

i know but i really cant make it up in my mind....so even an example would help i mean in my mind my code is right but windows say no.....

If I were looking for help on an English programming forum, I'd be sure to translate my program into English, to help them understand it.

Have you considered helping us to help you?

Adak 419 Nearly a Posting Virtuoso

I think this is an easier way:

1) Generate every 2 digit number, and put it into an int array[100]. Just one dimension is needed. Note that you will have only 89 2 digits numbers, in the range 10 - 99.

2) Now your program selects a rand() % N + 10 //(10 to 89)
N = 90 to start with.

Each time your program chooses a random number from the array (by index), you will move the highest random number element, and put it into the element that was just chosen.

So if your random number was 23, then you move whatever value is in [99], into [23]. N now becomes N--, since you have used up one of the random numbers.

That's pretty slick and easier to do than to describe, almost,

Adak 419 Nearly a Posting Virtuoso

your strcpy parameters are backwards:

strcpy( destination, source).

How are you handling the sort requirements for the names, so Binary search will keep working?

Adak 419 Nearly a Posting Virtuoso

You need to change the file name extension, right off!

Recommendations:

1) Dot cpp is the default file extension for C++, so it can cause much confusion and wasted time. Change it to just dot c, and then we're at least running on the same language compiler

2) gets() is very unsafe, since it makes no check on the length of the string it is getting from the user. Use
fgets(bufferName, sizeof(bufferName), stdin), instead.

3) flushing stdin is non-standard and doesn't always work. Use getchar() to pull the newline off the keyboard buffer, as needed.

4) feof() doesn't act as you suspect or hope.
while((fgets(buff, sizeof(buff), fp)) != NULL) { is much better.

where buff is the name of a char array big enough to receive the line of text (all of it).

You haven't said what your problems with coding up these changes are, so I don't know what else to advise, right now.

Once you know how to find and display one record from the file, there's no difficulty in displaying a page full of records at once, prompting the user to hit enter to continue, and displaying the next page of data, until either the end of the file, or the user presses q to quit the display of records.

Programs involve very explicit code and use very exact logic (good or bad, the program uses it). So the more specific your questions are, the better …

Salem commented: Yes +20
Adak 419 Nearly a Posting Virtuoso

A modify function has 3 parts:

1) You have to ask which student name they want to modify and
put that new name, into a small auxiliary char array.

2) You have to then call a search function to see if that name exists, and if so, what is the index number. Binary search does that, and any search can do it, also.

3) Then strcpy() the new name, into the array[], at the index that the search function gave you.

Anything you can do by any other means in an array, you can also do with pointers. It just loses clarity for most people, when you start working with pointers.

NOTE: If you add a name to the array being searched by Binary Search, that name has to either be in already sorted order (not likely), or the array has to be resorted, or don't sort the names, but sort an auxiliary array of ints or pointers, and use that to work with the array[] in the binary search function. A binary search only works if the data is in sorted order (as it see's it).

Adak 419 Nearly a Posting Virtuoso

You only need one for loop:

for(i = 0; i < 2; i++)  
{
  Ask for the user to enter a temp
  user enters a temp
  You check the user's entered number to see if it's greater than 
  max  temp
  
  Now print the number user entered

}
print max temp
Xufyan commented: thanks :-) +0
Adak 419 Nearly a Posting Virtuoso

Xufyan, you are going to *have* to learn to indent your code and especially your braces, like you are sane - even if you're not ;)

for(i = 0; i < whatEver; i++)
{
    //other code in here, then:
}

Note how the braces line up with the first line of code - their "parent line". Your eye just flows, right to the major and minor lines of code, and it only gets better as you code more often.

You indent your code like that, and you'll see the answer. You print max temp right after the last closing brace of the for loop.

Why?

Because you're done entering data.

jephthah commented: lol. i agree, that drives me nuts. +7
Adak 419 Nearly a Posting Virtuoso

Salem, he says he wants to use no functions. Could just count them up, but then that's the same thing as going through it with the index iterator.

Adak 419 Nearly a Posting Virtuoso

The way to do this is to set max equal to the temp, ONLY if the temp entered is greater than the value of max.

make sense?

Adak 419 Nearly a Posting Virtuoso

you're using i as the iterator for both of the nested for loops! ;)

And why are using two loop for this? You only have 2 elements in your array to fill up.

Can't you get rid of the inner for loop?

Adak 419 Nearly a Posting Virtuoso
#include <stdio.h>
#include <string.h>

#define N 25

int DoBinarySearch(char name[], char SName[][N], int rows);

int main() {
  int i, rows = 7; 
  char name[N] = {"\0"};
  char SName[7][N] = {
  {"Aiden"},
  {"Alice"},
  {"Bill"},
  {"Bob"},
  {"Charles"},
  {"Cynthia"},
  {"Dahlia"}
  };
  
  printf("\n\nEnter a name to search for: ");
  fgets(name, sizeof(name), stdin);
  name[strlen(name) - 1] = '\0';  //remove the newline from name

  i = DoBinarySearch(name, SName, rows);
  if(i > -1)
    printf("\nFound it: %s", SName[i]);
  else
    printf("\nThat name could not be found.");

  name[0] = '\0';


  i = getchar(); 
  printf("\n\n\t\t\t    press enter when ready");
  return 0;

}
int DoBinarySearch(char name[], char SName[][N], int rows)
{
  int Middlepoint, result;
  int LowerB= 0;
  int UpperB= rows-1;
  //printf ("\nBinary search not ready! Complete it\n");
  while (UpperB >= LowerB)
  {
    Middlepoint=(LowerB + UpperB)/2;
    result = strcmp(name, SName[Middlepoint]);
    if(result < 0)
      UpperB = Middlepoint-1;
     else if(result==0) 
            return Middlepoint;
     else
         LowerB = Middlepoint + 1;
  }
  return -1; //not found
}

When I had the strcmp() ... in the earlier code, I meant for you to finish filling in the ... with your actual array names. ;)

Adak 419 Nearly a Posting Virtuoso

Let me put some example together. Back in a bit.

Please use code tags (the [code] icon in the edit or reply window), around your program.

Just highlight the code, and click on the [code] icon - then your program will look like a program, instead of being all squashed to the left margin of the window.

Adak 419 Nearly a Posting Virtuoso

The number I'm looking for is valid when it's positive, and nine digits. I used ( (value >= 100000000) && (value <= 999999999) ) first, which worked okay, but did not account for leading zeroes. How do I validate a nine digit number, using only math and no functions, with possible leading zeroes?

What you have isn't a number then. Numbers in base 10 can't begin with leading zero's. You have a bunch of digits, only.

Normally, I'd ask what data type "value" is (let's say it's a char array), then just use functions like strtol() to convert it to a long int, and Bob's your Uncle.

By far the easiest way is to treat 000042 (for instance), as a bunch of digits in a char array, and "walk" through the char array from right to left, and multiply each digit with it's column, according to the base 10 numbering system:

Loop starts here:

Far right column is * 1 (or just add), so '2' becomes 2
next column to the left is 10's, so 4 * 10 = 40, add the 2 and you have 42, your new subtotal.

Loop stops when you reach the end of the string.

You won't know if a 0 might have a leading digit further to the left of it, and thus be a legit part of the number, or just another leading left side zero.

In any case 0 * 100 + 42 is still 42, so we're good.

Adak 419 Nearly a Posting Virtuoso

Maybe the idea was to simply explicitly print the answers, and getting the data columns, lined up.

There is no choice needed, so no if statement is necessary, imo.

Standard practice would be to use a loop to print this table up.

Adak 419 Nearly a Posting Virtuoso

Suggestions for your Binary search function:

#
int DoBinarySearch(char name[], char czStudentName[][16], int N, int *FoundPointer)
{
int Middlepoint,i=0;
int LowerB= 0;
int UpperB= N-1;
You don't want a pointer set to -1. You want the index of the student, in the array, if found. Middlepoint already gives you that.
//here you shall fullfill the code
//printf ("\nBinary search not ready! Complete it\n");
while (UpperB >= LowerB)
{
    Middlepoint=(LowerB + UpperB)/2;
    /* just make ONE strcmp() and assign it to a variable. then make
        all your comparisons, to that variable
    */
     int result = strcmp() ...
     if(result <0)
      Upperb=Middlepoint-1;
     else if(result==0) 
            return Middlepoint;
     else
         LowerB=Middlepoint + 1;
}//COMMENT: Also found or not?
 return -1; //not found

Your function returns the results, let your calling function print any found/not found, messages.

I haven't run this binary search function, but the idea is what I'm trying to convey. You need no pointers, at all, since what you want is an index (integer). Middlepoint is that number, if the target value is found. You make just one strcmp() per loop, and use the result it returns to you, to make your logic for the search, work.

You can have this function print up the results, but if you do, watch out. Generally, you get the best looking output if the calling function (the higher function), handles all messages like that.

Adak 419 Nearly a Posting Virtuoso

I'm making one that uses strings, but it's not nearly as easy as using scanf() and numbers.

Adak 419 Nearly a Posting Virtuoso

if( number > 0) then add it into the variable representing the sum of the positive integers.

Average of the group = sum of the group, divided by the number in the group.

Note that "Text speak" is not too welcome, here.

Adak 419 Nearly a Posting Virtuoso

you have 10 minutes in which you can edit your code, and make it look right.

After that, you can't.

Click on the "edit" button, then click on "go advanced" button.

Now highlight your code with the mouse, and click on the [code] icon at the top of the advanced editing window.

That will help make your code look much better.

Do that now, and I'll post back, afterward.

Your error means that you have more { braces, than you have } braces.

If you indent your code just 2 to 5 spaces (not tabs), and use code tags, then errors like this are super easy to spot - for you and everyone else.

If you don't do it, people tend to ignore your posts more often.