C++中如何把配置文件写成JSON格式的

![![图片说明](https://img-ask.csdn.net/upload/201705/28/1495934445_765926.png)图片说明](https://img-ask.csdn.net/upload/201705/28/1495934427_841484.png)图片说明
如图,我可以把数据存成配置文件的格式,但是主管说不行要存成JSON格式的发过去,可以提供一个写成JSON的代码吗?

0

2个回答

图片说明
要写成这样的格式

0

用jsoncpp,可以方便的处理json数据和读写json文件。

0
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
C++中如何把配置文件写成JSON格式的
CRegFile reg;rn reg.SetFilePath(g_szDefaultPath+_T("\\Materiel\\a.ini"));rn AfxMessageBox(g_szDefaultPath+_T("\\Materiel\\a.ini"));rn if(searchrecord2(*m_pAdo,szSql,&Rs,&lCol,&lRow))rn rn for(int i=0;i
C:while中的把“==”写成“=”
while中的把“==”写成“=”       通过做题,会发现易错的就是:容易把“==”写成“=”。在while 语句中,更容易发生这样的动作。接下来分析各种情况。 问题:下面的代码循环体执行几次? (1)代码一如下: #include <stdio.h> int main() { int i=1; while (i=0) { i++; } printf("%...
SQL 查询内容如何写成json格式
我的SQL语句查出来的数据(不知道放到datatable还是什么地方):rn[code=sql]rnpatient_name patient_id prescription_code diagnosis drug_unit hospaital_drug_codern杨家珍 197332 197332|2 购药 瓶 1626rn杨家珍 197332 197332|2 购药 瓶 1662rn杨家珍 197332 197332|1 购药 盒 1675rn杨家珍 197332 197332|1 购药 盒 1654rn王美英 326311 326311|3 犬咬伤 支 18182[/code]rn我的类型:rn[code=csharp] public class prescription_datarn rn public string patient_name get; set; rn public string patient_id get; set; rn public Recipe_List[] recipe_list get; set; rn }rn public class Recipe_Listrn rn public string prescription_code get; set; rn public string diagnosis get; set; rn public Medicine_Details[] medicine_details get; set; rn }rnpublic class Medicine_Detailsrn rn public string drug_unit get; set; rn public string hospaital_drug_code get; set; rn }rn[/code]rn这样定义是为了冗余字段不重复显示在json中,第一二字段是患者信息,第三四字段是处方头信息,第五六字段是处方明细信息,和上面的sql查询语句对应。rn我想要的结果:rn[code=Json]rnrn “patient_name”: “杨家珍”,rn “patient_id”: “197332”,rn “recipe_list”: [rn rn “prescription_code”: “197332|2”,rn “diagnosis”: “购药”,rn “medicine_details”: [rn rn “drug_unit”: “瓶”,rn “hospaital_drug_code”: “1626”,rn ,rn rn “drug_unit”: “瓶”,rn “hospaital_drug_code”: “1662”,rn rn ]rn ,rn rn “prescription_code”: “197332|2”,rn “diagnosis”: “购药”,rn “medicine_details”: [rn rn “drug_unit”: “盒”,rn “hospaital_drug_code”: “1675”,rn ,rn rn “drug_unit”: “盒”,rn “hospaital_drug_code”: “1654”,rn rn ]rn rn ]rn,rnrn “patient_name”: “王美英”,rn “patient_id”: “326311”,rn “recipe_list”: [rn rn “prescription_code”: “326311|3”,rn “diagnosis”: “犬咬伤”,rn “medicine_details”: [rn rn “drug_unit”: “支”,rn “hospaital_drug_code”: “18182”,rn rn ]rn rn ]rn[/code]rn结果里面数据库字段一二只显示一次,但是病人杨家珍有两个prescription_code(处方头),因此字段三四需要显示两次,每个处方头有两条明细,明细全部显示。rn问题应该不是很难,就怕我没有描述清楚
c如何写成dll
一直都在用tc写着程序,但是现在想写个程序自己用,在windows下我选了vb,但由于对vb不是很熟悉,所以主要拿来做界面用,用c来解问题。程序的主要功能是用来实现对marc数据的读取,我有一个marc文件没有解压都有4G多,里面有一百多万条记录。我把文件做成另一种结构的数据,C主要的工作就是查找和写入,VB主要是对读取的数据进行修改,或是新建数据送给C,然后C写入。rnrn刚刚在VB区那里发了问题,那里的大虾说要把C写成dll来调用,刚刚进入windows编程,dll要用什么工具来编译它?有什么规则之类等。rnrn想问大虾们要几本电子书来~rn谢谢了..
Android如何把json格式的数据存储到xml中
private void getAddress(){ Log.e("获取地址","......."); /*StringBuilder sb = new StringBuilder(); AssetManager am = activity.getAssets(); try { BufferedReader b
服务器使用json格式配置文件
服务器使用json格式配置文件
Python: 读取JSON格式的配置文件
有时候需要用Python读取配置文件,如果配置文件格是JSON格式的,就很容易读取,下面是一个例子:配置文件名为para.cfg,内容如下:qingsong@db2a:~/python$ cat para.cfg{        "username":"qingsong",        "password":"mypassed",        "age":24, "address": 
如何把MDIChild写成dll中?
我想把主窗体设为MDIForm,然后把MDIChild写成,但老是提示"NO MDI Forms are currently active";请问该如何解决?缺什么参数,请各位高手帮忙
JDBC优化--写成配置文件
注:配置文件必须写在工程的src目录下 package p1; import java.sql.*; import java.util.*; class Person{ @Override public String toString() { return "Person [id=" + id + ", name=" + name + "]"; } int id; Str...
读取Json格式的配置文件
读取Json格式的配置文件,代码摘自百度UEditor的Config,简洁明了:public static class Config { private static JObject _JObjectItems; public static JObject JObjectItems { get { if (_JObj...
c中如何更新配置文件
不同端口对应不同配置文件,需求是根据端口自动生成配置文件,大家有没有效率高点的实现方法啊,希望做过这方面的同志指点指点
帮我把它写成c语言!
我用IDA反编译了一个文件。看看我的理解对不对。rn.text:100717A5 ; 圹圹圹圹圹圹圹?S U B R O U T I N E 圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹圹?rn.text:100717A5 rn.text:100717A5 ; Attributes: library functionrn.text:100717A5 rn.text:100717A5 ___init_time proc near ; DATA XREF: .data:100B414Corn.text:100717A5 cmp dword_100BBFC4, 0rn.text:100717AC push esirn.text:100717AD jz short loc_10071809rn.text:100717AF push 0ACh ; size_trn.text:100717B4 push 1 ; size_trn.text:100717B6 call _calloc ; 函数有两个参数size_t,size_trn.text:100717BB mov esi, eaxrn.text:100717BD pop ecx ; 函数参数出栈rn.text:100717BE test esi, esirn.text:100717C0 pop ecxrn.text:100717C1 jnz short loc_100717C8 ; sf=0符号位为正rn.text:100717C3 rn.text:100717C3 loc_100717C3: ; CODE XREF: ___init_time+3Cjrn.text:100717C3 push 1 ; push 1;rn.text:100717C3 ; pop eax;是给eax赋值为1吗?rn.text:100717C5 pop eaxrn.text:100717C6 pop esirn.text:100717C7 retnrn.text:100717C8 ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?rn.text:100717C8 rn.text:100717C8 loc_100717C8: ; CODE XREF: ___init_time+1Cjrn.text:100717C8 push esirn.text:100717C9 call sub_10071836 ; __get_lc_timern.text:100717CE test eax, eaxrn.text:100717D0 pop ecxrn.text:100717D1 jz short loc_100717E3rn.text:100717D3 push esirn.text:100717D4 call sub_10071B84 ; __free_lc_timern.text:100717D9 push esi ; void *rn.text:100717DA call _freern.text:100717DF pop ecxrn.text:100717E0 pop ecxrn.text:100717E1 jmp short loc_100717C3 ; push 1;rn.text:100717E1 ; pop eax;是给eax赋值为1吗?rn.text:100717E3 ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?rn.text:100717E3 rn.text:100717E3 loc_100717E3: ; CODE XREF: ___init_time+2Cjrn.text:100717E3 push dword_100BBFF0rn.text:100717E9 mov off_100B3CF4, esirn.text:100717EF call sub_10071B84 ; __free_lc_timern.text:100717F4 push dword_100BBFF0 ; void *rn.text:100717FA call _freern.text:100717FF pop ecxrn.text:10071800 mov dword_100BBFF0, esirn.text:10071806 pop ecxrn.text:10071807 jmp short loc_10071832rn.text:10071809 ; 哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?rn.text:10071809 rn.text:10071809 loc_10071809: ; CODE XREF: ___init_time+8jrn.text:10071809 push dword_100BBFF0rn.text:1007180F mov off_100B3CF4, offset off_100B3CF8rn.text:10071819 call sub_10071B84 ; __free_lc_timern.text:1007181E push dword_100BBFF0 ; void *rn.text:10071824 call _freern.text:10071829 and dword_100BBFF0, 0rn.text:10071830 pop ecxrn.text:10071831 pop ecxrn.text:10071832 rn.text:10071832 loc_10071832: ; CODE XREF: ___init_time+62jrn.text:10071832 xor eax, eaxrn.text:10071834 pop esirn.text:10071835 retnrn.text:10071835 ___init_time endprn.text:10071835 rn
【帮忙把这个C++改写成C的】
[code=C/C++]#includern#includern#includern#include rnusing namespace std;rnclass student rnrnprotected: rn int number;rn char name[20];rn char sex[6];rn char tel[20];rn char nation[6];rn char birth[20];rn char party[10];rn char id[20];rn float score[6];rnpublic: rn student *next; rn student() rn ~student() rn char* getname() return name; rn int getnumber() return number;rn double getscore(int i) return score[i];rn float getg() return (score[0]+score[1]+score[2]+score[3]+score[4]+score[5]); rn void input()rn rn int e=1;rn cout<<"\t\t\t按提示输入:"<>number;rn cout<<"\t\t输入姓名: ";rn cin>>name;rn cout<<"\t\t输入性别: ";rn cin>>sex;rn if(strcmp(sex,"男")==0 || strcmp(sex,"女")==0)rn rn cout<<"\t\t输入电话号码: ";rn cin>>tel;rn cout<<"\t\t输入民族:";rn cin>>nation;rn cout<<"\t\t输入出生日期(如1990-08-15):";rn cin>>birth;rn cout<<"\t\t输入政治面貌: ";rn cin>>party; rn cout<<"\t\t输入身份证号: ";rn cin>>id;rn cout<<"\t\t输入高数分数: ";rn cin>>score[0];rn cout<<"\t\t输入大学英语分数: ";rn cin>>score[1];rn cout<<"\t\t输入面向对象程序设计分数:";rn cin>>score[2];rn cout<<"\t\t输入大学物理分数:";rn cin>>score[3];rn cout<<"\t\t输入数据结构分数:";rn cin>>score[4];rn cout<<"\t\t输入马克思列宁主义哲学分数:";rn cin>>score[5];rn e=0;rn rn elsern rn cout<<"\t\t\t无此类型性别!重新输入!"<>number>>name>>sex>>tel>>nation>>birth>>party>>idrn >>score[0]>>score[1]>>score[2]>>score[3]>>score[4]>>score[5];rn is.get(); rn rn void output()rn rn cout<<"学生基本信息如下:"<next=NULL; key=0; rn ~school() delete head; rn void input();rn void mend();rn void del();rn int find(student **p,int num,char *pn="^");rn void found();rn void show();rn void count();rn void save();rn void begin();rn void clear();rn char mainmenu();rn int getkey() return key;rn void setkey(int k) key=k; rnprivate: rn student *head; rn int key;rn;rn//录入函数rnvoid school::input()rnrn student *p,*p2=NULL;rn p=head; rn int n;rn while(p->next)rn p=p->next;rn while(n)rn rn p2=new student;rn p2->input();rn p->next=p2;rn p2->next=NULL;rn p=p->next; rn school::setkey(1);rn cout<<"\t\t\t按1继续,按0返回 : ";rn cin>>n;rn rnrn//子查找函数rnint school::find(student **p1,int num,char *pn)rnrn student *p;rn p=head;rn while(p->next)rn rn (*p1)=p;rn if( (p->next)->getnumber()==num||!strcmp( (p->next)->getname(),pn ) )rn return 1;rn p=p->next;rn rn return 0;rnrn//查找函数rnvoid school::found()rnrn student *p;rn int num=-1,n=9;rn char name[20]="^";rn dorn rn cout<<"\t\t1:按学号查找,2:按姓名查找: ";rn cin>>n;rn while(n<1||n>2);rn if(n==1)rn rn cout<<"\t\t\t输入学号: ";rn cin>>num;rn rn if(n==2)rn rn cout<<"\t\t\t输入姓名: ";rn cin>>name;rn rn if(!find(&p,num,name) )rn rn cout<<"\t\t找不到你要查找的内容!"<next)->output();rnrn//删除函数rnvoid school::del()rnrn student *p,*p2;rn int num;rn cout<<"\t\t\t输入学号: ";rn cin>>num;rn if( !find(&p,num,"^") )rn rn cout<<"\t\t找不到你要删除的内容!"<next)->output();rn p2=p->next;rn p->next=p2->next;rn delete p2;rn cout<<"删除成功,显示结果请选择菜单2!"<next)rn rn (p->next)->output();rn p=p->next;rn rnrn//修改函数rnvoid school::mend()rnrn student *p;rn int num=-1,n;rn char name[20]="^";rn dorn rn cout<<"\t\t1:按学号修改,2:按姓名修改: ";rn cin>>n;rn while(n<1||n>2);rn if(n==1)rn rn cout<<"\t\t\t输入学号: ";rn cin>>num;rn rn if(n==2)rn rn cout<<"\t\t\t输入姓名: ";rn cin>>name;rn rn if( !find(&p,num,name) )rn rn cout<<"\t\t找不到你要修改的内容!"<next)->output();rn (p->next)->input();rn school::setkey(1);rnrnrn//保存函数rnvoid school::save()rnrn student *p;rn p=head;rn ofstream os("student.txt",ios::out);rn if (school::getkey()==1)rn rn while(p->next)rn rn (p->next)->output(os);rn p=p->next;rn rn rn cout<<"\t\t\t文件已保存! "<>num;rn is.seekg(t);rn if(num<0)rn rn is.close();rn return;rn rn p2=new student;rn p2->input(is);rn p->next=p2;rn p2->next=NULL;rn p=p->next;rn rnrn//清空函数 rnvoid school::clear()rnrn student *p,*p2;rn p=head->next;rn while( p )rn rn p2=p;rn p=p->next;rn delete p2;rn rnrn//统计函数 rnvoid school::count()rnrn student *p;rn p=head;rn int n=0;rn double g[6]=0,0,0,0,0;rn float j[6]=0,0,0,0,0;rn while(p->next)rn rn p=p->next; rn n++;rn for(int i=0;i<6;i++)rn rn g[i]=g[i]+( p->getscore(i) );rn (p->getscore(i) )>=60? j[i]++ : 0 ;rn rn rn cout<<"\t\t\b\b\b\b高数总分:"<>n;rn return n[0];rnrn//主函数rnvoid main()rnrn school pp;rn int k=1;rn char n;rn pp.begin();rn while(k==1)rn rn n=pp.mainmenu();rn switch(n)rn rn case '1':pp.input(); break;rn case '2':pp.show(); break;rn case '3':pp.found(); break;rn case '4':pp.del(); break;rn case '5':pp.mend(); break;rn case '6':pp.count(); break;rn case '7':pp.save(); break;rn case '0':rn if(pp.getkey()==1)rn rn cout<<"\t\t\t是否保存? 1 : 保存 0:不保存 : ";rn cin>>k;rn if(k==1)rn pp.save();rn rn pp.clear();rn k=0;rn break;rn rn rnrnrn[/code]
如何把由从C++写的系统改写成C?
如何把由从C++写的系统改写成C?有经验的朋友请指点一下。谢谢~!
QT 读json格式配置文件的数据
{     "FirstName": "三",     "LastName": "张",     "Age": 43,     "Address": {         "Street": "长安街",         "City": "北京",         "Country": "中国"     },     "Phone numbers": [         "+44
Python解析json格式配置文件示例
ConfigParseJson.py import json class JSONObject: def __init__(self, d): self.__dict__ = d def __len__(self): return len(self.__dict__) class ConfigParseJson(): def __i...
把字符串转换成Json格式
需要用到第三方jar包,添加依赖 compile 'com.google.code.gson:gson:2.7' @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContent
把数据导入写成脚本
我要在企业管理里的导入数据向导,我导入一个EXCEL文件到一个数据库的表里,请问怎么把这一个过程写成SQL语句和存储过程,谢谢
把一列写成多列???
模块编号 角色编号 命令编号rnModuleID RoleID ModuleOrderIDrn001 001 001rn001 001 002rn001 001 003rn001 001 004rn001 001 005rn001 001 006rn001 001 007rn001 001 008rn001 001 009rn001 001 010rn001 001 011rn001 001 012rn001 001 013rn转换成:rnrnrn模块编号 角色编号 命令编号 命令编号 命令编号rnModuleID RoleID ModuleOrderID ModuleOrderID1 ModuleOrderID2rn001 001 001 002 003rn001 001 004 005 006rn001 001 007 008 009rn001 001 010 011 012rn001 001 013 rnrn
把json格式数据写入到本地文件
思路分析:1.使用File在指定位置创建出文件,如:e : / test1.json    2.获取数据的byte[]    3.使用输出流写入 第一步:创建文件 File file = new File("要创建的目录+文件详细名"); if(!file.exists()){ file.createNewFile(); } 第二步:获取json数据byte[],如
把HashMap转换成json格式
[code=&quot;java&quot;] import java.io.IOException; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map.Entry; import javax.servlet.http.HttpServletResponse;...
把文件流写成文件,或者是把二进制数据写成文件
把文件流写成文件,或者是把二进制数据写成文件
如何把查询结果写成文本文件
我想写一个存贮过程,把一个查询结果写到一个文本文件中,我应当怎么做??rn像这个样子rnselect file1,file2 from table1 output 'C:\result.SQL'rnrn有这样的系统存贮过程吗???
如何把APPLICAITON改写成APPLET
[size=12px][b]小弟刚刚学JAVA不久rnrn自己编了一段程序 想改成APPLETrnrn却总失败rnrn哪位大大能帮忙改下这段APPLICAITONrnrn谢谢[/b][/size]rnimport javax.swing.*;rnimport java.awt.*;rnimport java.awt.event.*;rnrnpublic class MainBomb extends JFrame rnrn private JButton keyButton[]=new JButton[9];rn rn int b=0;int c=0;rnrn public MainBomb()rn rn rn Listener nListener = new Listener();rn Listener2 bListener = new Listener2();rn rn rn Container container = getContentPane();rn container.setLayout(new BorderLayout());rn JPanel p1=new JPanel(); rn p1.setLayout(new GridLayout(3,3)); rn int k= (int)(Math.random()*9);//set the Button and Bombrn rn for(int i=0;i<=8;i++)rn rn keyButton[i]=new JButton();rn p1.add(keyButton[i]);rn keyButton[i].setBackground(Color.gray); rn if(i==k)rn rn keyButton[k].addActionListener(bListener);rn rn elsern rn keyButton[i].addActionListener(nListener); rn rn rn rn rn rn rn container.add(p1,BorderLayout.CENTER);rn rn rn rn rn rn public static void main(String[] args)rn rn String strLine = System.getProperty("line.separator"); rn JOptionPane.showMessageDialog(null,"Welcome to Mini-MineSweeper"+ strLine +rn "The object of the game is click on all" + strLine +rn "the squares EXCEPT the one with the bomb." + strLine +rn "(There is only one bomb).To choose a square" + strLine +rn "To display please simply click on the square.",rn "Message",JOptionPane.INFORMATION_MESSAGE);rn rn rn MainBomb frame = new MainBomb ();//set the main framern frame.setTitle("Boom!");rn frame.setSize(400,200);rn frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); rn frame.setVisible(true);rn rn rn Dimension screenSize=rn Toolkit.getDefaultToolkit().getScreenSize(); //let the frame be centerrn int screenWidth = screenSize.width;rn int screenHight = screenSize.height;rn rn int x=(screenWidth - frame.getWidth())/2;rn int y=(screenHight - frame.getHeight())/2;rn rn frame.setLocation(x,y);rn rn rn rn rnrnrnrn private class Listener implements ActionListener//the win listenerrn rn public void actionPerformed(ActionEvent e)rn rn JButton n = (JButton)e.getSource();rn n.setBackground(Color.white); rn c++;rn if (c==8) rn face2 a2= new face2();//set the happy facern rn a2.setTitle("Boom!");rn a2.setSize(400,200);rn a2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); rn a2.setVisible(true);rn rn rn Dimension screenSize2=rn Toolkit.getDefaultToolkit().getScreenSize();rn int screenWidth2 = screenSize2.width;rn int screenHight2 = screenSize2.height;rn rn int x2=(screenWidth2 - a2.getWidth())/2;rn int y2=(screenHight2 - a2.getHeight())/2;rn rn a2.setLocation(x2,y2);rn setVisible(false); rn rn int chose1 = JOptionPane.showConfirmDialog (null,"Congratulations!You win!"+rn "Would you like to play again?","Message",JOptionPane.YES_NO_OPTION);// the yes or no choosernrn if (chose1==JOptionPane.YES_OPTION)rn rn a2.setVisible(false); rn c=0;rn MainBomb frame = new MainBomb ();//the game starts againrn rn frame.setTitle("Boom!");rn frame.setSize(400,200);rn frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); rn frame.setVisible(true);rn Dimension screenSize=rn Toolkit.getDefaultToolkit().getScreenSize();rn int screenWidth = screenSize.width;rn int screenHight = screenSize.height;rn rn int x=(screenWidth - frame.getWidth())/2;rn int y=(screenHight - frame.getHeight())/2;rn rn frame.setLocation(x,y);rn rn rn elsern System.exit(0); rn rn rn rn private class Listener2 implements ActionListener//the lose listenerrn rn public void actionPerformed(ActionEvent e)rn rn JButton n = (JButton)e.getSource();rn n.setBackground(Color.black); rn b++;rn if (b==1&&c!=8)rn face a1= new face();//set the sad facern rn a1.setTitle("Boom!");rn a1.setSize(400,200);rn a1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); rn a1.setVisible(true);rn rn rn Dimension screenSize1=rn Toolkit.getDefaultToolkit().getScreenSize();rn int screenWidth1 = screenSize1.width;rn int screenHight1= screenSize1.height;rn rn int x1=(screenWidth1 - a1.getWidth())/2;rn int y1=(screenHight1 - a1.getHeight())/2;rn rn a1.setLocation(x1,y1);rn rn rn rn int chose = JOptionPane.showConfirmDialog (null,"BOOooM!!!"+rn "Would you like to play again?","Message",JOptionPane.YES_NO_OPTION);rn setVisible(false); rn rn if (chose==JOptionPane.YES_OPTION)rn rn a1.setVisible(false); rn rn c=0;rn rn MainBomb frame = new MainBomb ();rn rn frame.setTitle("Boom!");rn frame.setSize(400,200);rn frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); rn frame.setVisible(true);rn Dimension screenSize=rn Toolkit.getDefaultToolkit().getScreenSize();rn int screenWidth = screenSize.width;rn int screenHight= screenSize.height;rn rn int x=(screenWidth - frame.getWidth())/2;rn int y=(screenHight - frame.getHeight())/2;rn rn frame.setLocation(x,y);rn rn rn rn rn elsern System.exit(0); rn rnrn rn rn rnrn class face extends JFrame//draw the happy facern rn public face()rn rn rn getContentPane().add(new Ovals());rn rn rn class Ovals extends JPanelrn rn public void paintComponent(Graphics g)rn rn super.paintComponent(g); rn g.setColor(Color.black);rn g.fillRect(0, 0, 400, 200);rn g.setColor(Color.red);rn g.fillOval(120,10,30,30);rn g.fillOval(230,10,30,30);rn g.drawArc(110,100,160, 100, 0, 180);rn rn rn rn rn rn class face2 extends JFrame//draw the sad facern rn public face2()rn rn rn getContentPane().add(new Ovals2());rn rn rn class Ovals2 extends JPanelrn rn public void paintComponent(Graphics g)rn rn super.paintComponent(g); rn g.setColor(Color.black);rn g.fillRect(0, 0, 400, 200);rn g.setColor(Color.red);rn g.fillOval(120,10,30,30);rn g.fillOval(230,10,30,30);rn g.drawArc(110,50,160, 100, 180, 180);rn rn rn rn rnrnrn
如何把数据库的表写成一个xml文件
能给个代码最好rn不行给个xml文件的格式
如何把下面的验证改写成javascript
ERR
html如何把伪类写成内联样式
html如何把伪类写成内联样式,因为我没有办法修改CSS文件,head区域也没有修改权限,所以我只能将这个链接显示样式的CSS代码写进我能有修改权限的HTML代码部分!
如何把以下MSSQL写成DB2
[code=SQL]rnCREATE TABLE ts11(TTDCTO VARCHAR(20), TTDOCO VARCHAR(20), TTKCOO VARCHAR(20), TTLNID VARCHAR(20), TTCFGPID INT, TTDS01 VARCHAR(20))rninsert ts11 SELECT 'S9' ,'80001181', '00100', '11000', 0 ,NULL rnunion all select 'S9' ,'80001181', '00100', '11000', 1 ,'脚'rnunion all select 'S9' ,'80001181', '00100', '11000', 1 ,NULLrnunion all select 'S9' ,'80001181', '00100', '11000', 1 ,'板'rnunion all select 'S9' ,'80001181', '00100', '11000', 1 ,NULL rnunion all select 'QO' ,'50032192', '00100', '1000', 0 ,NULL rnunion all select 'QO' ,'50032192', '00100', '1000', 1 ,'脚'rnunion all select 'QO' ,'50032192', '00100', '1000', 1 ,'脚'rnrnCREATE FUNCTION f_ts11(@TTDCTO VARCHAR(20),@TTDOCO VARCHAR(20), @TTKCOO VARCHAR(20), @TTLNID VARCHAR(20))rnRETURNS VARCHAR(100)rnBEGINrn DECLARE @sql VARCHAR(100)rn SELECT @sql=ISNULL(@sql+',','')+TTDS01rn FROM ts11 rn WHERE TTDCTO=@TTDCTO AND TTDOCO=@TTDOCO AND TTKCOO=@TTKCOO AND TTLNID=@TTLNID AND TTCFGPID=1rn AND ISNULL(TTDS01,'')<>''rn rn RETURN @sql rnENDrnrnUPDATE ts11 SET TTDS01=dbo.f_ts11(TTDCTO,TTDOCO, TTKCOO, TTLNID)rnWHERE TTCFGPID=0rnrnSELECT * FROM ts11rnrn[/code]rn以上是MS-SQL rn麻烦大家把创建函数的这部分写成DB2。谢谢各位了。
如何把一个过程写成一个线程
我写的一个过程由于调用很多excel文件,所以在执行时会占用很多cpu资源,从而导致程序运行时无法接受其它响应,也就是程序完全被这个过程占用。rn 请问如何解决?盼赐教
如何把orcle存储过程写成sql语句
有这方面的小工具或者别的什么吗。可以联系369378633@qq.com 有重谢
如何把包含"#"的一段代码写成宏
如:#pragma ...rn变成:#define MYMACRO #pragma ...
如何把一段Html代码写成字符串
如下rnrn rnrn把上面的写一个字符串赋值到一个变量CSSrnVar css=""
求助,如何把这代码写成存储过程
dd db = new dd();rn protected void Page_Load(object sender, EventArgs e)rn rn string sql = "select * from ProductPrice";rn DataTable dt1 = new DataTable();rn dt1= db.createTable(sql);rnrn for(int j=0;j= Balance && sum1 < Bearing)rn rnrn string sql02 = "select Bearing_Proportion,Bearing_Direction from Quotes where Be_Proportion='" + pp + "' and Be_Direction='" + sa + "'";rn DataTable dt3 = new DataTable();rn dt3 = db.createTable(sql02);rn float Proportion = Convert.ToInt32(dt3.Rows[0]["Bearing_Proportion"].ToString()); string update01 = "update ProductPrice set PricePercent='" + Proportion + "',Trend='" + rnrnDirection + "' where PP_id='" + pid + "'";rn db.execute(update01);rnrnrn rn else if (sum1 >= Bearing && sum1 < Mutation)rn rn string sql02 = "select Mutation_Proportion,Mutation_Direction from Quotes where Be_Proportion='" + pp + "' and Be_Direction='" + sa + "'";rn DataTable dt3 = new DataTable();rn dt3 = db.createTable(sql02);rn float Proportion = Convert.ToInt32(dt3.Rows[0]["Mutation_Proportion"].ToString());rn string update01 = "update ProductPrice set PricePercent='" + Proportion + "',Trend='" + Direction + "' where PP_id='" + pid + "'";rn db.execute(update01);rnrn rn else//大于突变rn rn string sql02 = "select Max_Proportion,Max_Direction from Quotes where Be_Proportion='" + pp + "' and Be_Direction='" + sa + "'";rn DataTable dt3 = new DataTable();rn dt3 = db.createTable(sql02);rn float Proportion = Convert.ToInt32(dt3.Rows[0]["Max_Proportion"].ToString());// string update01 = "update ProductPrice set PricePercent='" + Proportion + "',Trend='" + rnrnDirection + "' where PP_id='" + pid + "'";rn db.execute(update01);rnrn rn rnrnrn如何把这段代码在SQL里写成 [color=#FF0000]存储过程[/color]rnrn谢谢!
如何把这条SQL语句写成存储过程?
[code=SQL]rnrn StringBuilder sql2 = new StringBuilder( "Select Top " + PageSize + " * from I_ToolPlan where WTPROD+WTTOOL not in(select top " rn + PageSize * CurrentPage + " WTPROD+WTTOOL from I_ToolPlan order by WTPROD+WTTOOL desc) "); rnrnrnrn rn if(TextBox1.Text != "" & TextBox2.Text != "" ) rnrn rn sql2.Append( " and WTPROD between '"+TextBox1.Text.Trim()+"' and '"+TextBox2.Text.Trim()+"' ");rn rn rnrn if(TextBox3.Text != "" & TextBox4.Text != "") rnrn rn sql2.Append(" and WTTOOL >='"+TextBox2.Text.Trim()+"' and WTTOOL<= '"+TextBox4.Text.Trim()+"'");rn rn rnrn rn sql2.Append(" order by WTPROD+WTTOOL desc");rnrnrn[/code]
如何把INSERT和update写成一个复合语句?
我想添加一个记录,并把添加的时间用update修改现存的一个记录里。rn如果用2句必然有时间上的间隔。rnINSERT TABLE (id,_date) VALUES (100,getdate())rnupdate TABLE set _date=getdate() where id=99
如何把DIVX的编码数据写成文件??
我现在已经完成DIVX的视频编码,只是不知怎样把视频编码数据写成文件,比如AVI(DIVX:))文件和DIVX文件,有谁知道DIVX 的文件结构吗?
如何把这个sql语句写成存储过程?
以下这个代码中, lBrandID,lLanguageID,lCategoryID均为从前一个页面传递进来的变量,我这个大语句主要实现从上一个页面的点击查询产品子类的时候生成页面的sql,由于现在数据量很大,每次点击都要消耗很长时间的查询,因此我想以存储过程实现,但是我不知道如何写,另外,这种想法是否成熟?请高手给与解答,并且能写出存储过程,谢谢!rnrnrnselect Distinct products.id,nvl(products.SSIXDIGITCODE,'000000') sku,rn products.sname,products.sdesc,products.NDMPRICE,NBEANS,npri,rn CODEDESC.SNAME dawei,NBRANDID,NBEANSPROMOTION,NDMPRICEPROMOTION,rn0 mPrice,-1 nSaleID,products.NEXCHANGEHALLID nDefaultProductLine,0 nIsInCabinet,rn2 nIsOutOfStock,0 mMinQuantity,1 fInvQty,1 fAllocateQty,rn1 fInvSafeQty,0 mMinQuantity, NCLOBDETAILS,NBLOBIMGBIG,NBLOBIMGSMALLrnfrom products,CODEDESCrnwhere NBRANDID =1rnand products.NUNITID = CODEDESC.id(+) and CODEDESC.NCODETYPEID=20 and CODEDESC.NLANGUAGEID=1rnand products.nstatusid=1rnand products.nlockid=1rnand products.nSaleID=1rnand products.NLANGUAGEID =1rnand products.NDMPRICE > 0rnand products.npri > 0rnand products.id not inrn ( select NPRODUCTID from DMCATEGORYPRODUCT where NCATEGORYID = 1 )rn
如何把这两条语句写成一条?
Delete from 论文发表 Where 序列号=@strItemIDrnDelete from 论文信息 Where 序列号=@strItemIDrn
如何把下列语句改写成存储过程
procedure TC_zfmx_s.y_btExecute(Sender: TObject);rnvar strm:string;rnintm:integer;rnbeginrn inherited;rn with c_zfmx dorn beginrn for intm:=1 to 4 dorn beginrn strM := intTOstr(IntM);rn with asmaster dorn beginrn close;rn sql.Clear;rn sql.add('update eat_r_brushcard set atime' + '_'+strM);rn sql.add('=isnull(eat_title_brushcard.atime ,0)');rn sql.add('from eat_r_brushcard');rn sql.add('left join');rn sql.add('(select mem_id,adate,atime from eat_title_brushcard');rn sql.add('where s_no=' + strM );rn sql.add(')eat_title_brushcard');rn sql.add('on eat_title_brushcard.mem_id=eat_r_brushcard.mem_id and eat_title_brushcard.adate=eat_r_brushcard.adate');rn execsql;rn end;rn
如何把一个文件写成UTF8格式的
以下是我程序,但保存后的文件还是ANSI格式的,就是用记事本打开里面还是可以看的字符,原test.txt是看不懂的字符rnrnrnvarrn tmpFileName: String;rn tmpFile: TextFile;rn tmpUTF8Str: UTF8String;rn tmpStr: AnsiString;rn i: Integer;rnbeginrn tmpFileName := 'D:\Temp\test.txt';rn AssignFile(tmpFile, tmpFileName);rn tryrn Rewrite(tmpFile);rn for i := 0 to Memo1.Lines.Count - 1 dorn beginrn tmpStr := Memo1.Lines[i];rn tmpUTF8Str := AnsiToUtf8(tmpStr);rn Writeln(tmpFile, tmpUTF8Str);rn end;rn finallyrn CloseFile(tmpFile);rn end;rn ShowMessage('OK');