int main(void)
{
	float salary;
	printf("\aEnter your desired monthly salary:");
	printf("$_______\b\b\b\b\b\b\b");
	scanf_s("%f", &salary);
	printf("\n\t$%.2f a month is $%.2f a year.", salary, salary * 12);
	printf("\rGee!\n");

	getchar();
	getchar();


	return 0;
}
Exemplo n.º 2
0
int main()
{
	int len = 28;
	//scanf_s("%d", &len);
	int p[28] = { 32, 103, 24, 88, 95, 70, 97, 15, 102, 6, 79, 46, 51, 37, 93, 108, 9, 58, 53, 58, 79, 36, 58, 91, 78, 58, 61, 81 };
	RadixSort Radix;
	Radix.radixSort(p, len);
	//insert_sort(p, len);
	for (int i = 0; i < len; i++)
	{
		printf("%d,", *(p + i));
	}
	scanf_s("%d", &len);
	return 0;
}
Exemplo n.º 3
0
int _tmain(int argc, _TCHAR* argv[])
{
	TCHAR *b = (TCHAR*)malloc(10);
	TCHAR *buf = (TCHAR*)malloc(0);
	STARTUPINFO info;
	ZeroMemory(&info, sizeof(info));
	PROCESS_INFORMATION proinfo = { 0 };
	printf("please input the dll you want see:");
	scanf_s("%s",b,10);
	wsprintf(buf, TEXT("cmd.exe /k DUMPBIN -exports c:\\windows\\system32\\%S.dll"), b);
	CreateProcess(NULL, buf, NULL, NULL, FALSE, NULL, NULL, NULL, &info, &proinfo);
	WaitForSingleObject(proinfo.hProcess, INFINITE);
	printf("%s", buf);
	return 0;
}
Exemplo n.º 4
0
void te(){
	printf("どこに置く?:");
	do{
		scanf_s("%d", &okimasu);
	} while (okimasu / 10000 != 0||okimasu/100>tate||okimasu%100>yoko);
	if (masu[okimasu / 100][okimasu % 100][0] == bomb){
		endflag = 1;
	}
	else{
		masu[okimasu / 100][okimasu % 100][1] = masu[okimasu / 100][okimasu % 100][0];
		if (masu[okimasu / 100][okimasu % 100][1] == kara){
			kuri_han(okimasu);
		}
	}
}
Exemplo n.º 5
0
int main()
{
	double result = 0.0;
	double base = 0.0;
	int exponent = 0;
	printf("Please input base and exponent: ");
	scanf_s("%lf,%d", &base, &exponent);
	result = Power(base,exponent);
	if (g_InvalidInput == 1)
		printf("The input is invailable!\n");
	else 
		printf("%lf ^ %d = %lf\n",base,exponent,result);

	return 0;
}
void DeleteVideo(LINKEDLIST* list){
	int temp = 0;
	printf("»èÁ¦ÇÒ ºñµð¿À ¹øÈ£ : ");
	scanf_s("%d", &temp);
	fflush(stdin);
	NODE * pFindFlag = SSearchNumber(list, temp);
	if (pFindFlag)
	{
		list->DeleteAt(list, pFindFlag);
	}
	else
	{
		printf("ÀÏÄ¡ÇÏ´Â ºñµð¿À°¡ ¾ø½À´Ï´Ù.\n");
	}
}
Exemplo n.º 7
0
void removeContact(struct contact *tailContact)
{
	struct contact *currentContact;
	currentContact = (struct contact *)malloc(sizeof(struct contact));
	clearContact(currentContact);

	setCursorPosition(40,4); printColouredText("please enter record id: ", 2);
	fflush(stdin);
	scanf_s("%i", &currentContact->idNum);
	

	findDeleteContact( tailContact, currentContact);

	free(currentContact);
}
Exemplo n.º 8
0
int main(void)
{
	char name[40];
	printf("What's your name.\n");
	scanf_s("%s", name);
	printf("Hello,%s.%s\n", name, PRAISE);
	printf("Your name of %d letters occupies %d memory cells.\n",
		strlen(name), sizeof name);
	printf("The phrase of praise has %d letters",
		strlen(PRAISE));
	printf("and occupies %d memory cells.\n", sizeof PRAISE);
	getchar();
	getchar();
	return 0;
}
Exemplo n.º 9
0
int main()
{
	int len=7;
	//scanf_s("%d", &len);
	int p[8] = { 6, 12, 4, 63, 2, 35, 11 };
	InsertionSort insert;
	insert.insertionSort(p, len);
	//insert_sort(p, len);
	for (int i = 0; i < len; i++)
	{
		printf("%d,", *(p + i));
	}
	scanf_s("%d", &len);
    return 0;
}
Exemplo n.º 10
0
int readInput(INTERVAL *arr1) // Read input from user
{

	int n = 0;
	char ch;

	while (1)
	{
		scanf_s("%d-%d", &arr1[n].min, &arr1[n].max);
		ch = getchar();
		n++;
		if (ch != ',')  break;
	}
	return n;
}
void DeleteVideo(LINKEDLIST* list){
	int temp = 0;
	printf("찾을 값 : ");
	scanf_s("%d", &temp);
	fflush(stdin);
	NODE * pFindFlag = SSearchNumber(list, temp);
	if (pFindFlag)
	{
		list->DeleteAt(list, pFindFlag);
	}
	else
	{
		printf("그런거 없다.");
	}
}
Exemplo n.º 12
0
void main()
{
	int i, choice = 1;
	startNode = NULL;

	while (choice != 0)
	{
		puts("Please select an option:\n");
		puts("---------------------------------------");
		puts("01\tInsert a Node");
		puts("02\tDelete a Node");
		puts("03\tDisplay all Nodes");
		puts("04\tSearch for a Node");
		puts("\n00\tExit");
		puts("---------------------------------------\n");

		fflush(stdin);
		scanf_s("%d", &choice);

		switch (choice)
		{
		case 1:
			insertNode();
			break;

		case 2:
			deleteNode();
			break;

		case 3:
			displayAll();
			break;

		case 4:
			findNode();
			break;

		case 0:
			break;

		default:
			puts("Invalid selection!\n");
			break;
		}
	}
	free(startNode);
	free(currentNode);
}
Exemplo n.º 13
0
void inputItem(ItemStruct* ior_item)
{
    int numberOfArgumentsRecived;
    int okFlag;

    do
    {
        //TODO (Extra): Blanka alla ch_arr innan vi skriver till dem!!
        printf_s("Name of item %d: ", (*ior_item).isId);
        okFlag = readLine(ior_item->isName, sizeof(ior_item->isName));

        if (ior_item->isName[0] == '\0')
        {
            printf_s("Name cannot be empty!\n");
            okFlag = FALSE;
        }
        else if (okFlag == FALSE)
        {
            // Inmatningen är för lång.
            printf_s("WARNING! The entered Name has been truncated!\n");
            okFlag = TRUE;
        }
        // scanf_s("%s", &ior_item->isName[0], sizeof(ior_item->isName)); // Bryter vid mellanslag
        // flushRestOfLine();
    } while (!okFlag);

    do
    {
        printf_s("Number of this item: ");
        numberOfArgumentsRecived = scanf_s("%f", &ior_item->isAmount); // Space after %f replaces flushRestOfLine
        flushRestOfLine();

        if (numberOfArgumentsRecived == 1)
        {
            break;
        }
        else
        {
            printf_s("*** Please enter a number! ***\n");
        }
    } while (TRUE);

    printf_s("Enter the Unit: ");
    okFlag = readLine(ior_item->isUnit, sizeof(ior_item->isUnit));

    // scanf_s("%s", &ior_item->isUnit[0], C_UNIT_NAME_LENGTH);
    // flushRestOfLine();
} // inputItem
Exemplo n.º 14
0
int main()
{
	int a[4];
	int i;
	printf("please enter 4 numbers:\n");
	for (i = 0; i < 4; i++)
	{
		scanf_s("%d", &a[i]);
	}
	for (i = 0; i < 4; i++)
	{
		printf("%d  ", *(a + i));
	}
	return 0;

}
Exemplo n.º 15
0
void judge3() {
	int num;
	printf("请输入年份:\n");
	scanf_s("%d", &num);
	if (0 == num % 4 && 0 != num%100) {
		printf("%d是闰年\n", num);
	}
	else if (0 == num % 400){
		printf("%d是闰年\n", num);
	}
	else
	{
		printf("%d不是闰年\n", num);
	}
	finish();
}
Exemplo n.º 16
0
int main( void )
{
	std::vector<int> priceTable = {
		1, 5, 8, 9, 10, 17, 17, 20, 24, 30
	};

	int len;
	printf_s( "input rod length : " );
	scanf_s( "%d", &len );

	printf_s( "MaxPrice : %d\n", GetMaxPrice( len, priceTable ) );

	getchar();
	getchar();
	return 0;
}
Exemplo n.º 17
0
	void GetCLDev()
	{
		cl_int ret = 0;
		int index = 0;
		std::vector<cl_device_id> devices;
		GetDeviceIds(devices);
		for (unsigned int i = 0; i < devices.size(); ++i)
		{
			PrintDeviceInfo(i + 1, devices[i]);
		}


		printf("Enter device no:");
		scanf_s("%d", &index);
		m_currentDev = devices[index - 1];
	}
Exemplo n.º 18
0
int main(void)
{
   int t_ct; // term count
   double time, x;
   int limit;

   printf("Enter the number of terms you want: ");
   scanf_s("%d", &limit);
   for (time = 0, x = 1, t_ct = 1; t_ct <= limit; t_ct++, x *= 2.0)
   {
      time += 1.0 / x;
      printf("time = %f when terms = %d.\n", time, t_ct);
   }

   return 0;
}
Exemplo n.º 19
0
int main(void)
{
	float weight;
	float value;
	printf("Are you worth your weight in rhodium?\n");
	printf("Let's check it out!\n");
	printf("Please enter you weight in pounds.\n");
	scanf_s("%f", &weight);
	value = 770 * weight*14.5833;
	printf("Your weight in rhodium is worth $%.2f\n", value);
	printf("You are easily worth that!If rhodium prise drop,\n");
	printf("eat more to maintain you value!");
	getchar();
	getchar();
	return 0;
}
Exemplo n.º 20
0
int main()
{
	FILE *f;
	freopen_s(&f, "input.txt", "r", stdin);
	
	char ch;
	int i;

	fseek(f, 2, SEEK_SET);
	scanf_s("%c", &ch);
	
	freopen_s(&f, "output.txt", "w", stdout);
	printf("%c %d", ch,ch);

	return 0;
}
Exemplo n.º 21
0
void ovning3_A()
{
	int tal;

	printf("Ange tal:");
	scanf_s("%d", &tal);

	if (tal % 2 == 0)
	{
		printf("Tal är jämnt \n");
	}
	else
	{
		printf("Tal är udda \n");
	}
}
Exemplo n.º 22
0
int main()
{
	char board[BOARD_SIZE][BOARD_SIZE];
	init_board(board);
	board[3][3] = WHITE_K;
	//board[2][4] = BLACK_M;
	//board[4][4] = BLACK_M;
	//board[5][7] = EMPTY;
	print_board(board);
	print_message(WRONG_MINIMAX_DEPTH);
	perror_message("TEST");
	Move* m = get_all_moves(board, WHITE);
	print_moves(m);
	scanf_s("DONE");
	return 0;
}
int main()
{
	int girilenSayi;
	int basamak4, basamak3, basamak2, basamak1;
	int *x;

	printf("4 basamakli bir sayi giriniz:");
	scanf_s("%d",&girilenSayi);
	x = &girilenSayi;

	islem(x);


	_getch();
	return 0;
}
Exemplo n.º 24
0
Arquivo: 源.c Projeto: huruji/C
main()
{
	int a = 0,c;
	char ch, dh,eh;
	while ((c = getchar()) != EOF)
	{
		if(c == '\n')
		{
			++a;
		}
	}
	printf("%d\n", a);
	scanf_s("%c\t%c\v%d\n", &ch, &dh, &eh);
	printf("%c\t%c\v%d\n", ch, dh, eh);
	return 0;
}
Exemplo n.º 25
0
int main()
{
	int num,i=7;
	char arr[9];
	printf("Enter a number: ");
	scanf_s("%d", &num);
	arr[8] = '\0';
	while (num != 0){
		arr[i] = num % 10+'0';
		i--;
		num = num / 10;
	}
	permutations(arr, i+1, 7);
	_getch();
	return 0;
}
Exemplo n.º 26
0
int main()
{
	unsigned int N;
	
	printf("Input any number : ");
	scanf_s("%u", &N);

	do
	{
		N = AddPosi(N);
		printf("%u\n", N);
	} while (N >= 10);


	return 0;
}
Exemplo n.º 27
0
int main()
{
	void cs();
	int chr;
lp:cs();
swindex:printf("Your choice:");
    scanf_s("%d",&chr);
	//chr = chr - 48;
	switch (chr)
	{
	case 1:system("cls"); goto lp; break;
	case 2:break;
	default:printf("error\n"); goto swindex;
	}
	return 0;
}
Exemplo n.º 28
0
# include <stdio.h>
# include <stdlib.h>
# include <time.h>
int N;  //For N * N ChessBoard
int flag;
void printArray(int a[]);        /* Just to Print the Final Solution */
void getPositions(int a[], int n1, int n2);  /* The Recursive Function */
int main_NQueens()
{
	int *a;
	int ctr = 0;
	printf("\nTHE N QUEENS PROBLEM ");
	printf("\nNumber Of Rows(N) For NxN Chessboard.");
	scanf_s("%d", &N);
	a = (int *)(malloc(sizeof(int)*N));
	printf("\nAll possible Solutions ..  \n");
	printf("\nIn Each of the solutions the Coordinates of the N-Queens are given (Row,Col) .");
	printf("\nNote that the Rows and Colums are numbered between 1 - N :\n");
	for (ctr = 0; ctr<N; ctr++)
		getPositions(a, 0, ctr);
	getchar();
	getchar();
}
Exemplo n.º 29
0
//This code checks what the user wants for special feature when reaching the end of the GameBoard
int bonus()
{
	int i;
	printf("Choose which choice you want :  1. Delete a oppponent  \n");
	scanf_s("%d", &i);

	if (i == 1) {
		printf("Delete oppponent !\n");
		return 1;
	}
	else
	{
		printf("Invalid choice , bonus lost!\n");
		return 0;
	}
}
Exemplo n.º 30
0
void input_task(coro_input_t::self_t& self, input_args* pia)
{
	while (true)
	{
		printf("number: ");
		if (!scanf_s("%d", pia->target))
		{
			b_quit = true;
			return;
		}
    
		self.yield();
	}

	printf("ERROR: should not reach the end of input function\n");
}