Click here to Skip to main content
14,846,774 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
QuestionWhy calling sort() crashes? Pin
Kumar Anitesh9-Oct-13 23:29
MemberKumar Anitesh9-Oct-13 23:29 
AnswerRe: Why calling sort() crashes? Pin
Richard MacCutchan10-Oct-13 0:32
mveRichard MacCutchan10-Oct-13 0:32 
QuestionNativeWindow? Win32?? Pin
Aidoru7511-Sep-13 0:17
MemberAidoru7511-Sep-13 0:17 
AnswerRe: NativeWindow? Win32?? Pin
Richard MacCutchan17-Sep-13 0:36
mveRichard MacCutchan17-Sep-13 0:36 
AnswerRe: NativeWindow? Win32?? Pin
Albert Holguin15-Oct-13 6:44
professionalAlbert Holguin15-Oct-13 6:44 
Questionsocket programming in forms app Pin
Cbrown33010-Sep-13 5:28
MemberCbrown33010-Sep-13 5:28 
AnswerRe: socket programming in forms app Pin
Richard MacCutchan15-Sep-13 21:24
mveRichard MacCutchan15-Sep-13 21:24 
Questioncan't get out of loop Pin
Member 1021996721-Aug-13 16:31
MemberMember 1021996721-Aug-13 16:31 
Hi, I actually have 2 problems. If i enter gcgc, it should give me 4 when counting G's and C's but it gives me 3 instead. Also, the program doesn't stop by itself (I have to press control C to get out). What is wrong with my code?
#include <iostream>
#include <algorithm> 

 
using namespace std;
 

int main() {
 
char input = ' ';
 int count = 0;
char newinput = ' ';
 int newcount = 0;
 
 cout << "Enter the DNA strand:";
 cin >> input;
 

while (input != '\n')
 {cin.get(input);
   switch (toupper(input))
{
case 'C': 
    count++;
    break;
    case 'G':
    count++;
    break;}}
 cout << "There are " << count << " C's and G's in this DNA strand."<< endl;
 

while (input != '\n')
 {cin.get(input);
   switch (toupper(input))
 {
case 'B':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin>>newinput;
cin.clear();
cin.ignore('\n');
 
  break;
case 'D':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'E':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'F':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'H':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'I':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'J':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'K':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'L':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'M':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'N':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'O':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'P':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'Q':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'R':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'S':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'U':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'V':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'W':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'X':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'Y':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
case 'Z':
    cout << "Invalid sequence! Please enter the correct nucleotide sequence:"; 
cin.clear();
  cin.ignore('\n');
  break;
}
}
 

while (newinput != '\n') 
 { cin.get(newinput);
   switch (toupper(newinput))
  { case 'C': 
    newcount++;
    break;
    case 'G':
    newcount++;
    break;
}
}
 
 cout << "There are " << newcount << " C's and G's in this DNA strand." << endl;
 

 
return 0;
}

AnswerRe: can't get out of loop Pin
Richard MacCutchan21-Aug-13 21:30
mveRichard MacCutchan21-Aug-13 21:30 
QuestionIndirect assembly dependency issue Pin
Member 1016773115-Aug-13 5:40
MemberMember 1016773115-Aug-13 5:40 
AnswerRe: Indirect assembly dependency issue Pin
Pete O'Hanlon15-Aug-13 5:54
mvePete O'Hanlon15-Aug-13 5:54 
GeneralRe: Indirect assembly dependency issue Pin
John Schroedl15-Aug-13 7:23
professionalJohn Schroedl15-Aug-13 7:23 
Questionunhandled exception of type 'System.Runtime.InteropServices.SEHException' when trying to call C# dll from MFC Pin
PrasadHPShenoy5-Aug-13 23:04
MemberPrasadHPShenoy5-Aug-13 23:04 
AnswerRe: unhandled exception of type 'System.Runtime.InteropServices.SEHException' when trying to call C# dll from MFC Pin
Richard MacCutchan14-Aug-13 21:15
mveRichard MacCutchan14-Aug-13 21:15 
Questiongot error while writing into excel file Pin
kumsudheer5-Aug-13 2:28
Memberkumsudheer5-Aug-13 2:28 
AnswerRe: got error while writing into excel file Pin
David Knechtges5-Aug-13 3:45
MemberDavid Knechtges5-Aug-13 3:45 
GeneralRe: got error while writing into excel file Pin
kumsudheer5-Aug-13 19:36
Memberkumsudheer5-Aug-13 19:36 
QuestionHow to add existing project in VS6.0 Pin
Shyam Kodase30-Jul-13 23:02
MemberShyam Kodase30-Jul-13 23:02 
AnswerRe: How to add existing project in VS6.0 Pin
NotPolitcallyCorrect30-Jul-13 23:43
MemberNotPolitcallyCorrect30-Jul-13 23:43 
AnswerRe: How to add existing project in VS6.0 Pin
Richard MacCutchan30-Jul-13 23:47
mveRichard MacCutchan30-Jul-13 23:47 
QuestionPointer in Managed Code Pin
NAVALMAN30-Jul-13 2:59
professionalNAVALMAN30-Jul-13 2:59 
AnswerRe: Pointer in Managed Code Pin
Richard MacCutchan30-Jul-13 5:54
mveRichard MacCutchan30-Jul-13 5:54 
GeneralRe: Pointer in Managed Code Pin
NAVALMAN31-Jul-13 22:54
professionalNAVALMAN31-Jul-13 22:54 
GeneralRe: Pointer in Managed Code Pin
Richard MacCutchan1-Aug-13 2:51
mveRichard MacCutchan1-Aug-13 2:51 
AnswerRe: Pointer in Managed Code Pin
jschell1-Aug-13 11:32
Memberjschell1-Aug-13 11:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.