问题就是编写一个程序计算a*sqr(x)+bx+c的根
但我怎么也不知道如何在程序中实现根号啊?怎么找也找不到。谁能帮个忙啊回答一下
还有如何实现输入字符串后自动按照字母大小排列,就类似于字典中将各个单词按字母顺序排列。我能实现比较各个字符串的第一个字符来排列,但是到第二个字符好象那个stringcmp函数就不好用了,谁能写段代码示例,十分感谢。。。。
#include <cmath> or <math.h> or <stdlib.h>
sqrt()
#include <string.h>
#include <stdio.h>
char string1[] = "The quick brown dog jumps over the lazy fox";
char string2[] = "The QUICK brown dog jumps over the lazy fox";
void main( void )
{
char tmp[20];
int result;
/* Case sensitive */
printf( "Compare strings:\n\t%s\n\t%s\n\n", string1, string2 );
result = strcmp( string1, string2 );
if( result > 0 )
strcpy( tmp, "greater than" );
else if( result < 0 )
strcpy( tmp, "less than" );
else
strcpy( tmp, "equal to" );
printf( "\tstrcmp: String 1 is %s string 2\n", tmp );
/* Case insensitive */
result = _stricmp( string1, string2 );
if( result > 0 )
strcpy( tmp, "greater than" );
else if( result < 0 )
strcpy( tmp, "less than" );
else
strcpy( tmp, "equal to" );
printf( "\t_stricmp: String 1 is %s string 2\n", tmp );
}