View Code of Problem 50

#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	char a[100];
	int num = 0;
	gets_s(a);
	for (int i = 0; i < strlen(a); i++) {
		if (a[i] >= '0'&&a[i] <= '9') {
			cout << a[i];
			num = 1;
		}
		else{
			if (a[i] == ' ') {

			}else if(num == 1) {
				cout << "*";
				num = 0;
			}
			else if (num == 0) {

			}
		}
	}
	return 0;
}
/*
Main.cc: In function 'int main()':
Main.cc:8:10: error: 'gets_s' was not declared in this scope
  gets_s(a);
          ^
Main.cc:9:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < strlen(a); i++) {
                    ^
*/

Double click to view unformatted code.


Back to problem 50