下载此文档

字符串例题(String examples).doc


文档分类:IT计算机 | 页数:约24页 举报非法文档有奖
1/24
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/24 下载此文档
文档列表 文档介绍
字符串例题(String examples)
Find the sum of 2 floating points
There are the following forms of floating-point numbers in the input and output:
P1P2... ... Qj
For integer parts, P1P2... Pi is a nonnegative integer
For the decimal part, Qj is not equal to 0
About input
The first line is the N group test data, each test data accounted for 2, respectively, two addends. There is a blank line between each test data, each line of data is not more than 100 characters
About output
N row, each test data has one line output is corresponding and. Output a floating-point number that must be guaranteed to be a decimal fraction that is not 0
Example input
Two
**********
**********


Example output

Ten million and two point one
#include<iostream>
#include<>
#include<iomanip>
#include<cmath>
#include<string>
#include<algorithm>
#include<fstream>
Using namespace std;
Void Jia (char str1[], char str2[]);
Int num[100] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
Int main ()
{
Int i = 0, j = 0, n = 0, d = 0, nu[26] = {0}, m[1000] = {0};
Char ch[100][100], ch2[100][100];
Cin>>n;
For (I = 0; I < n; i++)
{memset (ch[i],'\0', 100), memset (ch2[i],'\0', 100);
Cin>>ch[i]>>ch2[i];
}
For (I = 0; I < n; i++)
Jia (ch[i], ch2[i]),
Cout<<endl;
Return 0;
}
Void Jia (char str1[], char str2[])
{
Int i = 0, LC = 0, d = 0, l[5] = {0};
Char ch[123];
While (str1[i]! = '.')
I++;
L[1] = I + 1;
L[3] = strlen (STR1) - l[1];
I = 0;
While (str2[i]! = '.')
I++;
L[2] = I + 1;
L[4] = strlen (STR2) - l[2];
LC = (l[1] > l[2]? L[1]: l[2]) + 1;
L[0] = l[3] > l[4]? L[3]: l[4];
Memset (CH,'\0', 123);
For (I = l[0] - 1; I > = 0; i--)
{
If (str1[l[1] + i] ='\0'|| str2[l[2] + i] = ='\0')
Ch[lc + i] = ch[lc + i] + str1[l[1] + i] + str2[l[2] + i];
Else
{
If (str1[l[1] + i] - 2 *'0'+ str2[l[2] + i] + ch[lc + i] > 9)
{

字符串例题(String examples) 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数24
  • 收藏数0 收藏
  • 顶次数0
  • 上传人rjmy2261
  • 文件大小23 KB
  • 时间2017-11-08