Thread: need help with char and ints in an array

  1. #1
    Registered User
    Join Date
    Oct 2004

    need help with char and ints in an array

    below is a bit of a program that i am writing but at
    the moment im having a problem with the array

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    char start_board(char array[16]);
    int main (void)
    	char board[16];
    	int countdown = 5;
    	printf ("welcome to the block puzzle game\nyou must rearrange the numbers in to asending order\n\n");
    char start_board(char array[16])
    	int index = 0;
    	char board[16] = {'1','2','3','4','5','6','8','12','9','10','7','X','13','14','11','15'};
    	for(index = 0;index<=15;index++)
    		if (index ==4||index ==8|| index ==12)
    		printf ("%c  ", board[index]);
    	return board[16];
    How can i get the output to print the two digit numbers in the array and still shox the X when it pops up

    also i want to be able to scanf a integer and check if it is in the array although the array is in characters how would i do this

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Waterloo, Texas
    the main problem is that you didn't learn the C language well enough before jumping into your project. I suggest you read a book on the subject (lot's of tutorials online, too) before proceeding any further.
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
        return std::pow
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. convert char array to int array
    By skeme in forum C Programming
    Replies: 10
    Last Post: 09-07-2008, 10:37 PM
  2. Reading int's from file to array HELP plz
    By GARiMTO in forum C Programming
    Replies: 3
    Last Post: 12-14-2007, 06:12 AM
  3. Dictionary into a 2d Char Array... Problems.
    By Muzzaro in forum C Programming
    Replies: 10
    Last Post: 12-02-2006, 12:34 PM
  4. Dealing with ints that are in char array
    By Wiretron in forum C Programming
    Replies: 4
    Last Post: 05-15-2006, 04:06 PM
  5. Problem Putting INTs Into a CHAR Array
    By cram in forum C++ Programming
    Replies: 13
    Last Post: 10-13-2004, 07:53 AM