hinduengg 26 Junior Poster in Training

Is your file location correct? - "/etc/rc.d/rc.local"

hinduengg 26 Junior Poster in Training

yes perfectly true I did not run the code but I had the statements in mind quite well but not the order . I am sorry.

It is first extract the digit by mod method then use wherever you wish to and then divide the number by 10 to reduce it to zero.

hinduengg 26 Junior Poster in Training

the method is easy :)

hinduengg 26 Junior Poster in Training

You can extract the no.'s digits by this method :
if n is user's input of int type then

while(n>0)
{
  n=n/10;
  digit=n%10;
  if(digit==4)
   counter++;
 }

Then print the counter that contains the no. of 4's in your inputted number

hinduengg 26 Junior Poster in Training
#include <iostream>
#include <cstring>
                           // for strlen() [length of word]

using namespace std;

int main()
{
    char a[100];
     cout<<"enter your word"<<endl;     
    cin.getline(a,100);   // User input
    int l;
    l=strlen(a); // Length of input word
    int i;
    i = 0;
    while (i < len)  // the string always has last index for '\0'
    { 
  switch (a[i])
        {
        case 'a' : 
        case 'A' : cout << " Alpha";
        break; 
        case 'b' :
        case 'B' : cout << " Bravo";
        break;
        case 'c' :
        case 'C' : cout << " Charlie";
        break;
        case 'd' : 
        case 'D' : cout << " Delta";
        break; 
        case 'e' :
        case 'E' : cout << " Echo";
        break;
        case 'f' :
        case 'F' : cout << " Foxtrot";
        break;
        case 'g' : 
        case 'G' : cout << "Golf";
        break; 
        case 'h' :
        case 'H' : cout << " Hotel";
        break;
        case 'i' :
        case 'I' : cout << " India";
        break;
        case 'j' : 
        case 'K' : cout << " Kilo";
        break; 
        case 'l' :
        case 'L' : cout << " Lima";
        break;
        case 'm' :
        case 'M' : cout << " Mike";
        break;
        case 'n' : 
        case 'N' : cout << "November";
        break; 
        case 'o' :
        case 'O' : cout << " Oscar";
        break;
        case 'p' :
        case 'P' : cout << " Papa";
        break;
        case 'q' : 
        case 'Q' : cout << "Quebec";
        break; 
        case 'r' :
        case 'R' : cout << " Romeo";
        break;
        case 's' :
        case 'S' : cout << " Sierra"; …
hinduengg 26 Junior Poster in Training

Yes Narue is absolutely right. Thank you for informing me too.

hinduengg 26 Junior Poster in Training

Sorry that a stands for myString forgot to modify it ,now it is better and it prints each charecter on a separate line

#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<process.h>
int main()
{
  char myString[100];
  cout<<"Your statement"<<endl;
  if(cin.get(myString,100))
    cout<<myString<<endl;
   else
    exit(0);
  return 0;
}

Perhaps you could try out this but I have used at least once the concept of char array which is also called c-style string in C++

// these header files do not exist in latest
version of c++ but runs on my Turbo C++
very well out you could try out the logic
with your setup //

(exit(0) is a function to terminate the program after your work is over you may use it if you wish and is accessible from process.h)

Actually my college still accepts the old look of C++
Best of luck for your tour in C++

hinduengg 26 Junior Poster in Training
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<process.h>
int main()
{
  char myString[100];
  cout<<"Your statement"<<endl;
  if(cin.get(myString,100))
    cout<<a;
   else
    exit(0);
  return 0;
}

Perhaps you could try out this but I have used at least once the concept of char array which is also called c-style string.
// these header files do not exist in latest
version of c++ but runs on my Turbo C++
very well out you could try out the logic
with your setup //

You should use -usingnamespacestd for C++

(exit(0) is a function to terminate the program after your work is over you may use it if you wish and is accessible from process.h)

Actually my college still accepts the old look of C++
Best of luck for your tour in C++

hinduengg 26 Junior Poster in Training

Narue thank you for informing me about latest trend of C++
I still use Turbo C++ which accepts .h header files.Even in my college the same old setup is followed.
Definitely after finals I would install the latest hardware.
I am sure now thats why a lot of members use std strings and the info you gave and not string.h

and no char arrays in C++

I am sorry Bops for giving you old info

hinduengg 26 Junior Poster in Training

You are welcome.

Perhaps I think that if you write a program in C++ then you should include header files with extension - .h
and if use C then you should use haeder fies like -<iostream>
and <cstring> etc. as Narue said because both are different programming languages.

Compilation errors might occur otherwise.

hinduengg 26 Junior Poster in Training

I think the same .Bops you must use it as in C++

#include<iostream.h>
#include<stdio.h>
  void main()
{
   char a[100];
   cout<<"enter your sentence";
   gets(a);
   for(int x=0;a[x]!='\0';x++)
   { 
         if(a[x]=='|')
          a[x]=' ';
  cout<<a[x];
  }
  
}

This in C++ may be it might help you in C
The logic is correct.