第1个回答 2016-03-01
//#include "stdafx.h"//If the vc++6.0, with this line.
#include <iostream>
using namespace std;
int main(void){
char str[1000];
cout << "Enter a string...\n";
cin >> str;
for(int sum=0,i=0;str[i];sum+=str[i++]);
cout << "The total is " << sum << endl;
return 0;
}本回答被网友采纳