hey i am a beginner in programming.so it may sound stupid. but i really don't know many things. i want to write a program where user input can be both numbers or character strings/words. if it is number, it will be processed in a way; and if it is a word, it will be processed in another way. that means i want to check the input type and work according to that! i have tried this but it isn't working!
#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
int main()
{
int number;
string word;
cout<<"enter a number or a word\n";
while(cin>>number || cin>>word){
if(cin>>number){
cout<<number<<"\n";}
if(cin>>word){
cout<<word<<"\n";}
}
return 0;
}