- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
<分区>
#include <stdio.h>
#include <malloc.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
typedef struct node
{
char data[20];
char m[40];
int mcount;
struct node* next;
struct node* prev;
struct node* link;
} node;
struct node* dic ;
struct node* allocating ( int n ) ;
void add ( char* ) ;
int *search ( char* null, struct node* head ) ;
void show ( node* ) ;
int sorting ( char *, char * );
void delete_el ( node** head, node* p ) ;
int edit ( char* ) ;
int save ( node* head, char filename ) ;
int load ( node* head, char filename, int n ) ;
int main( void)
{
node *N = NULL ;
node *p ;
node *L ;
node *a ;
node *h ;
int n, nm, k, r, i ;
char filename [ 50 ] ;
char c_name [ 50 ] ;
char word [ 20 ] ;
r=0;
while(1)
{
r++;
system ( " cls " ) ;
puts ( "\t\t Dictionary Menu: \n" ) ;
puts ( "\t\t 1.Add. \n ") ;
puts ( "\t\t 2.Search. \n ") ;
puts ( "\t\t 3.Show. \n") ;
puts ( "\t\t 4.Edit. \n") ;
puts ( "\t\t 5.Delete. \n " ) ;
puts ( "\t\t 6.Compare. \n" ) ;
puts ( "\t\t 7.Save. \n" ) ;
puts ( "\t\t 8.Load. \n" ) ;
puts ( "\t\t 9.Clear. \n" ) ;
puts ( "\t\t 10.Quit. \n" ) ;
do
{
puts("\n Enter number of menu");
scanf("%d",&nm);
if ( nm==11 ) break ;
if ( ( r==1 ) && ( nm!=1 ) )
{
puts ( "\t\tAdd the word first!" ) ;
puts ( "\t\tPress any key to continue..." ) ;
getch ();
}
}
while((r==1)&&(nm!=1));
switch(nm)
{
case 1 ://INPUT
printf ( "\nEnter the word : " ) ;
fflush ( stdin ) ;
gets ( word ) ;
add ( word ) ;
break;
case 2 : //SEARCH
printf ( "\nEnter the word to search : " ) ;
fflush ( stdin ) ;
gets ( word ) ;
i = search ( word ) ;
if ( ! i )
printf ( "Word does not exist." ) ;
getch( ) ;
break ;
case 3 : //OUTPUT
show( word ) ;
getch( ) ;
break;
case 4 ://EDIT
printf ( "\nEnter the word you want to edit: " ) ;
fflush ( stdin ) ;
gets ( word ) ;
edit ( word ) ;
getch ( ) ;
break;
case 5 : //DELETE
printf("Enter name of country you want to delete: ");
fflush(stdin);
gets(c_name);
p = search(h,c_name);
//functia de jos NA
//delete1 (&h,p);
if (!p)
{
puts ("Operation was not performed");
puts ("Press any key to continue...");
//getch();
break;
}
else
puts ("Information about Country was deleted successfuly");
puts ("Press any key to continue...");
getch ();
break;
case 6 ://COMPARING
break;
case 7 ://SORTING
sorting( );
break;
case 8 ://SAVE TO FILE
printf ("Enter name of the file\n");
fflush(stdin);
gets(filename);
save(h,filename);
puts("Information was saved successfuly");
puts("Press any key to continue...");
getch ();
break;
case 9 ://LOAD FROM FILE
printf ("Enter name of the file\n");
fflush(stdin);
gets(filename);
n = length((h));
load(h,filename,n);
puts("Information was load successfuly");
puts("Press any key to continue...");
getch ();
break;
case 10 : //FREE MEMORY
//uncomment cand o creezi
//freememory( N );
printf("\n Press Enter to bring back the Menu");
getch();
break;
case 11 : //EXIT
//uncomment cand o creezi
//deldic( ) ;
exit ( 0 ) ;
}
}
}
node *allocating ( int n ) //ALLOCATING
{
node *head, *C, *p ;
int i;
for( i=0; i<n; i++ )
{
C = ( node* ) malloc ( sizeof ( *C ) ) ;
if ( !C )
{
puts ( "Memory was not allocated" ) ;
exit(1);
}
if( i == 0 )
{
head = C ;
}
else
{
p -> next = C ;
}
C -> next = NULL ;
p = C ;
}
return head ;
}
node *search( node *head, char *c_name ) //SEARCH
{
node *C ;
C = head ;
while ( C )
{
if ( strcmp ( C -> data, c_name ) == 0 )
{
return C;
}
C = C -> next ;
if ( C == head ) break ;
}
return NULL ;
}
void add ( node *head ) //ADDING
{
int i = 0 ;
int mozilla;
node *h;
puts ( "How many words do you want to add?" ) ;
scanf ( "%i", &mozilla ) ;
h = allocating ( mozilla ) ;
puts ( "Enter the words:\n" ) ;
while ( h )
{
printf("\t%d:\n", i+1 ) ;
i++ ;
puts ( "The word itself:\n" ) ;
fflush ( stdin ) ;
gets( h -> data [ i ] ) ;
puts ( "It's definition:\n" ) ;
fflush ( stdin ) ;
gets( h -> m[ i ] ) ;
if( h -> next == head ) break ;
h = h -> next ;
}
}
void show( ) //OUTPUT
{
struct node *n ;
int i, j ;
printf ( "Word\t\tMeaning\n" ) ;
for ( i = 0 ; i <= 30 ; i++ )
printf ( "-" ) ;
for ( i = 0 ; i <= 25 ; i++ )
{
n = dic [ i ] ;
while ( n != NULL )
{
printf ( "\n%s\t\t%s", n -> data, n -> m [ 0 ] ) ;
for ( j = 1 ; j < n -> mcount ; j++ )
printf ( "\n\t\t%s", n -> m [ j ] ) ;
n = n -> link ;
}
}
}
int length ( node *head ) //LENGTH
{
int l = 0 ;
node *C ;
C = head ;
while ( C )
{
C = C -> next ;
l++ ;
if( C == head ) break ;
}
return l ;
}
int save( node *head, char *filename ) //SAVE
{
FILE *fp ;
node *C ;
int i;
fp = fopen ( filename," w " ) ;
if ( !fp ) return 0 ;
C = head ;
while ( C )
{
fprintf ( fp, "%s %s \n" , C -> data [ i ] , C -> m [ i ] ) ;
C = C -> next ;
if ( C == head ) break ;
}
fclose ( fp ) ;
return 1 ;
}
int load(node *head, char *filename,int n) //LOAD
{
FILE *fp;
node *C;
int i;
fp = fopen ( filename, " r " ) ;
if ( !fp ) return 0 ;
C = head ;
while ( C )
{
fscanf ( fp, "%s %s \n" , &C -> data [ i ] , &C -> m [ i ] ) ;
if ( C -> next == head ) break ;
{
C = C -> next ;
}
}
fclose ( fp ) ;
return 1 ;
}
void delete_el ( node **head, node *p ) //DELETING
{
node *a ;
if ( *head == p )
{
p = *head ;
*head = p-> next ;
free ( p ) ;
return ;
}
else
{
a = *head ;
while ( a -> next != p )
{
a = a -> next ;
}
a -> next = p -> next ;
free ( p ) ;
return ;
}
}
//int sorting ( char *s1, char *s2 )
//{
// if ( strcmp ( s1, s2 ) == 0 ) return ( 0 ) ; //if they are equal
//
// for ( int i=0;s1[i]!=0;i++)
// {
// if ( data [ i ] > data [ i+1 ] ) return ( 1 ) ;
// else if ( s1 [ i ] < s2 [ i ] )return ( 2 ) ;
// }
//
// return ( 2 ) ; //hey if they are not equal and s1 not greater than s2 then s2 is greater
//}
我收到此错误消息:
C:\Users\user\Desktop\Untitled1.c||In function 'main':|
C:\Users\user\Desktop\Untitled1.c|96|warning: passing argument 1 of 'show' from incompatible pointer type|
C:\Users\user\Desktop\Untitled1.c|22|note: expected 'struct node *' but argument is of type 'char *'|
C:\Users\user\Desktop\Untitled1.c|115|warning: passing argument 1 of 'search' from incompatible pointer type|
C:\Users\user\Desktop\Untitled1.c|21|note: expected 'char *' but argument is of type 'struct node *'|
C:\Users\user\Desktop\Untitled1.c|115|warning: passing argument 2 of 'search' from incompatible pointer type|
C:\Users\user\Desktop\Untitled1.c|21|note: expected 'struct node *' but argument is of type 'char *'|
C:\Users\user\Desktop\Untitled1.c|115|warning: assignment from incompatible pointer type|
C:\Users\user\Desktop\Untitled1.c|149|warning: passing argument 2 of 'save' makes integer from pointer without a cast|
C:\Users\user\Desktop\Untitled1.c|26|note: expected 'char' but argument is of type 'char *'|
C:\Users\user\Desktop\Untitled1.c|160|warning: passing argument 2 of 'load' makes integer from pointer without a cast|
C:\Users\user\Desktop\Untitled1.c|27|note: expected 'char' but argument is of type 'char *'|
C:\Users\user\Desktop\Untitled1.c|209|error: conflicting types for 'search'|
C:\Users\user\Desktop\Untitled1.c|21|note: previous declaration of 'search' was here|
C:\Users\user\Desktop\Untitled1.c|227|error: conflicting types for 'add'|
C:\Users\user\Desktop\Untitled1.c|20|note: previous declaration of 'add' was here|
C:\Users\user\Desktop\Untitled1.c||In function 'add':|
C:\Users\user\Desktop\Untitled1.c|243|warning: passing argument 1 of 'gets' makes pointer from integer without a cast|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\stdio.h|356|note: expected 'char *' but argument is of type 'char'|
C:\Users\user\Desktop\Untitled1.c|246|warning: passing argument 1 of 'gets' makes pointer from integer without a cast|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\stdio.h|356|note: expected 'char *' but argument is of type 'char'|
C:\Users\user\Desktop\Untitled1.c||In function 'show':|
C:\Users\user\Desktop\Untitled1.c|253|error: number of arguments doesn't match prototype|
C:\Users\user\Desktop\Untitled1.c|22|error: prototype declaration|
C:\Users\user\Desktop\Untitled1.c|264|error: incompatible types when assigning to type 'struct node *' from type 'struct node'|
C:\Users\user\Desktop\Untitled1.c|289|error: conflicting types for 'save'|
C:\Users\user\Desktop\Untitled1.c|26|note: previous declaration of 'save' was here|
C:\Users\user\Desktop\Untitled1.c|307|error: conflicting types for 'load'|
C:\Users\user\Desktop\Untitled1.c|27|note: previous declaration of 'load' was here|
||=== Build finished: 7 errors, 8 warnings ===|
我试图通过屏幕截图捕获带有突出显示的元素,但在屏幕截图中,该元素不带有突出显示。有谁知道解决办法吗?当我捕获文本时会出现突出显示:automatests@gmail.com 查看我的代码: Utili
大家好,我是编码的新手,我正在和一位老师一起上 Java 入门课,希望您已经了解一切。我必须对冰雹序列进行编码,它表示为: 选择一些正整数并将其命名为 n。如果 n 是偶数,则将其除以二。如果 n 是
如果存在名称相同的SCOM组,则尝试制作一个请求更多信息(组ID)的脚本: function myFunction { [CmdletBinding()] Param(
我有这张表: id | CUPNAME | FRENCHNAME 1 | 2 | null 2 | null | 4 我想从非空的 CUPNAME 和 FRENCHNAME 中提
我是 Collection View 的新手,想知道这是否是创建它们的最佳方式,我还想了解一些关于从哪里转到启用分页的详细 View 的建议。 #import "MarbleCollectionVie
好的,这是非常好的 jquery slider 。 http://srobbin.com/jquery-plugins/pageslide 我所做的是 http://mbu.mn/test 问题来了。
...有人可以解释一下区别吗? 我在命令提示符下输入的内容: sys.path.append('M:/PythonMods') import qrcode myqr = qrcode.make("ra
我不时在我的服务器上运行 bash 脚本,我正在尝试编写一个脚本来监视日志文件夹并在文件夹超出定义的容量时压缩日志文件。我知道有更好的方法来做我目前正在尝试做的事情,非常欢迎您提出建议。下面的脚本抛出
我是 Groovy & Grails 的新手,我觉得事情不必那么难看……那么我怎样才能让这段代码更好看呢? 这是一个 Grails Controller 类,去掉了一些无趣的部分。尽量不要太挂断我的
关闭。这个问题需要更多focused .它目前不接受答案。 想改善这个问题吗?更新问题,使其仅关注一个问题 editing this post . 7年前关闭。 Improve this questi
在这个查询中,除了 5 个连接表之外,我试图使用第 6 个表“Days”将值与连接中的三个表进行比较。但它给了我错误,我不能在连接中使用子查询。 select a.ID, a.Name, a.AMT,
我不想通过 Xpath 提取,我想要更清晰的代码。谢谢我的世界兄弟 来自 Xpath,好的!! Assert.assertEquals("Digite um e-mail ou número de t
这个问题已经有答案了: Google Map is not loading due to inflate exception (3 个回答) 已关闭 9 年前。 我知道有很多关于此的帖子,但我就是无法
我的问题.. a.) 使用内存分配创建一个 float 组来存储 GPA 分数10名学生。为其分配值(您的选择) b.) 找出该数组中的最大 GPA。 c.) 将此数组的内容写入文件 alloc.tx
我最近要制作 Sequelize 。 我有 2 个表,data_track 和 car_detail。我想尝试关联那 2 个表,但它从未关联过。 总是返回错误SequelizeEagerLoading
我有一些代码在 LINQ 中根本无法工作的问题,但它确实可以作为一个简单的 for..each 工作。任何解释和解决方案将不胜感激。 我有 3 个类,Users、User 和 UserPermissi
我正在设计我的第一个大型数据库,并想检查我是否可以提供表关系。 我正在设计一个网络应用程序,其中 用户可以在团队中玩游戏 每个游戏都有其类别 用户为游戏创建他们的团队并选择他们的团队类别 每个游戏都启
我很抱歉成为一个 CSS 菜鸟,希望有人能指导我正确的方向。 我需要帮助的网页可以在 http://filefx.com 找到 当您点击该页面时,您会注意到“选择文件”图标和“上传文件”图标不在同一行
我已经尝试过这个我在网上找到的演示代码练习并创建了这个 slider ,使用滚动条更容易获得它,因为它们已经是为此制作的脚本。现在我正在尝试修改此脚本及其 css,以将滚动条更改为左右两侧的箭头。我已
最近我对 CSS 很感兴趣。学习不同的东西。 我正在尝试像这样放置三个 div: http://i.stack.imgur.com/miN9G.png 我得到的: http://i.stack.img
我是一名优秀的程序员,十分优秀!